	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function slot_save
LCPI0_0:
	.long	0                               ## 0x0
	.long	2                               ## 0x2
	.long	1                               ## 0x1
	.long	2048                            ## 0x800
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_slot_save
	.p2align	4, 0x90
_slot_save:                             ## @slot_save
	.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	$232, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movl	%edi, %ebx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAXPATHLEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	testl	%ebx, %ebx
	jle	LBB0_14
## %bb.1:
	leaq	L_.str(%rip), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edx
	callq	_GUI_MsgBoxOpen
	movq	_STATE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movl	$32, %edi
	callq	_memalign
	testq	%rax, %rax
	je	LBB0_26
## %bb.2:
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_state_save
	movq	%rax, %r12
	movq	%rax, -184(%rbp)
	testl	%r14d, %r14d
	je	LBB0_17
## %bb.3:
	movq	_rominfo@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	decl	%ebx
	leaq	L_.str.13(%rip), %rsi
	movq	%r15, -200(%rbp)                ## 8-byte Spill
	movq	%r15, %rdi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_sprintf
LBB0_4:
	movq	_CARD_WORKAREA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_SysArea@GOTPCREL(%rip), %rdi
	xorl	%r15d, %r15d
	xorl	%esi, %esi
	callq	_memset
	leaq	L_.str.15(%rip), %rdi
	leaq	L_.str.16(%rip), %rsi
	callq	_CARD_Init
	decl	%r14d
	movl	%r14d, %edi
	callq	_CardMount
	testl	%eax, %eax
	je	LBB0_28
## %bb.5:
	movq	$0, -216(%rbp)
	leaq	-216(%rbp), %rsi
	movl	%r14d, %edi
	callq	_CARD_GetSectorSize
	cmpq	$0, -216(%rbp)
	je	LBB0_29
## %bb.6:
	leaq	2116(%r12), %rsi
	movl	$32, %edi
	callq	_memalign
	testq	%rax, %rax
	je	LBB0_34
## %bb.7:
	movaps	l___const.slot_save.comment+48(%rip), %xmm0
	movaps	%xmm0, -128(%rbp)
	movaps	l___const.slot_save.comment+32(%rip), %xmm0
	movaps	%xmm0, -144(%rbp)
	movaps	l___const.slot_save.comment+16(%rip), %xmm0
	movaps	%xmm0, -160(%rbp)
	movaps	l___const.slot_save.comment(%rip), %xmm0
	movaps	%xmm0, -176(%rbp)
	leaq	-144(%rbp), %rdi
	movq	%rax, %rbx
	movq	-200(%rbp), %r15                ## 8-byte Reload
	movq	%r15, %rsi
	callq	_strcpy
	movq	_icon@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	movl	$2048, %edx                     ## imm = 0x800
	xorl	%eax, %eax
	callq	_memcpy
	leaq	8192(%rbx), %rdi
	leaq	-176(%rbp), %rsi
	movl	$64, %edx
	xorl	%eax, %eax
	callq	_memcpy
	movq	%r12, -208(%rbp)
	leaq	8448(%rbx), %rdi
	leaq	-208(%rbp), %rsi
	movl	$4, %edx
	xorl	%eax, %eax
	callq	_memcpy
	movq	%rbx, -192(%rbp)                ## 8-byte Spill
	leaq	8464(%rbx), %rdi
	movq	-208(%rbp), %rcx
	leaq	-184(%rbp), %rsi
	movq	%r13, %rdx
	movl	$9, %r8d
	callq	_compress2
	movl	$2116, %eax                     ## imm = 0x844
	addq	-184(%rbp), %rax
	movq	%rax, -184(%rbp)
	movq	-216(%rbp), %rcx
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_37
## %bb.8:
	xorl	%edx, %edx
	divq	%rcx
	testq	%rdx, %rdx
	je	LBB0_10
LBB0_9:
	incq	%rax
	imulq	%rcx, %rax
	movq	%rax, -184(%rbp)
LBB0_10:
	leaq	-232(%rbp), %rdx
	movl	%r14d, %edi
	movq	%r15, %rsi
	callq	_CARD_Open
	movq	_CARD_ERROR_READY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_40
## %bb.11:
	movq	%r15, -200(%rbp)                ## 8-byte Spill
	movl	%r14d, %r12d
	movq	-184(%rbp), %rbx
	subq	-232(%rbp), %rbx
	leaq	-232(%rbp), %r15
	movq	%r15, %rdi
	callq	_CARD_Close
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	testl	%ebx, %ebx
	jle	LBB0_39
## %bb.12:
	movslq	%ebx, %rdx
	leaq	L_.str.19(%rip), %rsi
	leaq	-232(%rbp), %rcx
	movl	%r12d, %r14d
	movl	%r12d, %edi
	callq	_CARD_Create
	testl	%eax, %eax
	je	LBB0_38
## %bb.13:
	leaq	L_.str.20(%rip), %rsi
	jmp	LBB0_42
LBB0_14:
	movq	_sram@GOTPCREL(%rip), %r12
	cmpl	$0, 16(%r12)
	je	LBB0_22
## %bb.15:
	movq	%r15, -200(%rbp)                ## 8-byte Spill
	movq	(%r12), %rsi
	xorl	%r15d, %r15d
	xorl	%edi, %edi
	movl	$65536, %edx                    ## imm = 0x10000
	callq	_crc32
	cmpq	8(%r12), %rax
	jne	LBB0_23
## %bb.16:
	leaq	L_.str.5(%rip), %rdi
	leaq	L_.str.6(%rip), %rsi
	callq	_GUI_WaitPrompt
	jmp	LBB0_46
LBB0_17:
	movq	%r13, -192(%rbp)                ## 8-byte Spill
	movq	_DEFAULT_PATH@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_rom_filename@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	leal	-1(%rbx), %r8d
	leaq	L_.str.8(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_sprintf
LBB0_18:
	leaq	L_.str.10(%rip), %rsi
	movq	%r15, %rdi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_30
## %bb.19:
	movq	%rax, %r13
	movq	%rbx, -248(%rbp)                ## 8-byte Spill
	movq	%r15, -200(%rbp)                ## 8-byte Spill
	movq	_CHUNKSIZE@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	xorl	%ebx, %ebx
	cmpq	%rsi, %r12
	jbe	LBB0_31
## %bb.20:
	movq	-192(%rbp), %r14                ## 8-byte Reload
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	leaq	(%r14,%rbx,4), %rdi
	movl	$1, %edx
	movq	%r13, %rcx
	callq	_fwrite
	movq	(%r15), %rsi
	addq	%rsi, %rbx
	subq	%rsi, %r12
	cmpq	%rsi, %r12
	ja	LBB0_21
	jmp	LBB0_32
LBB0_22:
	leaq	L_.str.2(%rip), %rdi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_27
LBB0_23:
	leaq	L_.str(%rip), %rdi
	leaq	L_.str.7(%rip), %rsi
	movl	$1, %edx
	callq	_GUI_MsgBoxOpen
	movl	$65536, %esi                    ## imm = 0x10000
	movl	$32, %edi
	callq	_memalign
	testq	%rax, %rax
	movq	-200(%rbp), %r15                ## 8-byte Reload
	je	LBB0_26
## %bb.24:
	movq	%rax, %r13
	movq	(%r12), %rsi
	movq	%rax, %rdi
	movl	$65536, %edx                    ## imm = 0x10000
	xorl	%eax, %eax
	callq	_memcpy
	movq	$65536, -184(%rbp)              ## imm = 0x10000
	movq	(%r12), %rsi
	xorl	%edi, %edi
	movl	$65536, %edx                    ## imm = 0x10000
	callq	_crc32
	movq	%rax, 8(%r12)
	testl	%r14d, %r14d
	je	LBB0_36
## %bb.25:
	movq	_rominfo@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.14(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_sprintf
	movl	$65536, %r12d                   ## imm = 0x10000
	jmp	LBB0_4
LBB0_26:
	leaq	L_.str.2(%rip), %rdi
	leaq	L_.str.3(%rip), %rsi
LBB0_27:
	callq	_GUI_WaitPrompt
	jmp	LBB0_45
LBB0_28:
	leaq	L_.str.2(%rip), %rdi
	leaq	L_.str.17(%rip), %rsi
	callq	_GUI_WaitPrompt
	movq	%r13, %rdi
	callq	_free
	jmp	LBB0_46
LBB0_29:
	leaq	L_.str.18(%rip), %rsi
	leaq	-112(%rbp), %rbx
	movq	%rbx, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_sprintf
	leaq	L_.str.2(%rip), %rdi
	movq	%rbx, %rsi
	jmp	LBB0_35
LBB0_30:
	leaq	L_.str.2(%rip), %rdi
	leaq	L_.str.11(%rip), %rsi
	callq	_GUI_WaitPrompt
	movq	-192(%rbp), %rdi                ## 8-byte Reload
	jmp	LBB0_44
LBB0_31:
	movq	-192(%rbp), %r14                ## 8-byte Reload
LBB0_32:
	movq	%rbx, -208(%rbp)
	leaq	(%r14,%rbx,4), %rdi
	movl	$1, %r15d
	movq	%r12, %rsi
	movl	$1, %edx
	movq	%r13, %rcx
	callq	_fwrite
	movq	%r13, %rdi
	callq	_fclose
	movq	%r14, %rdi
	callq	_free
	xorl	%eax, %eax
	callq	_GUI_MsgBoxClose
	movq	-248(%rbp), %r8                 ## 8-byte Reload
	testl	%r8d, %r8d
	jle	LBB0_46
## %bb.33:
	movq	_DEFAULT_PATH@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_rom_filename@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	decl	%r8d
	leaq	L_.str.12(%rip), %rsi
	movq	-200(%rbp), %rbx                ## 8-byte Reload
	movq	%rbx, %rdi
                                        ## kill: def $r8d killed $r8d killed $r8
	xorl	%eax, %eax
	callq	_sprintf
	movq	%rbx, %rdi
	callq	_gxSaveScreenshot
	jmp	LBB0_46
LBB0_34:
	leaq	L_.str.2(%rip), %rdi
	leaq	L_.str.3(%rip), %rsi
LBB0_35:
	callq	_GUI_WaitPrompt
	movl	%r14d, %edi
	callq	_CARD_Unmount
	jmp	LBB0_43
LBB0_36:
	movq	%r13, -192(%rbp)                ## 8-byte Spill
	movq	_DEFAULT_PATH@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_rom_filename@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	leaq	L_.str.9(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_sprintf
	movl	$65536, %r12d                   ## imm = 0x10000
	jmp	LBB0_18
LBB0_37:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
                                        ## kill: def $eax killed $eax def $rax
	testq	%rdx, %rdx
	jne	LBB0_9
	jmp	LBB0_10
LBB0_38:
	leaq	-232(%rbp), %r15
	movq	%r15, %rdi
	callq	_CARD_Close
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	leaq	L_.str.19(%rip), %rsi
	movl	%r14d, %edi
	callq	_CARD_Delete
LBB0_39:
	movl	%r12d, %r14d
	movl	%r12d, %edi
	movq	-200(%rbp), %r15                ## 8-byte Reload
	movq	%r15, %rsi
	callq	_CARD_Delete
LBB0_40:
	movq	-184(%rbp), %rdx
	leaq	-232(%rbp), %rcx
	movl	%r14d, %edi
	movq	%r15, %rsi
	callq	_CARD_Create
	testl	%eax, %eax
	je	LBB0_48
## %bb.41:
	leaq	L_.str.21(%rip), %rsi
LBB0_42:
	leaq	-112(%rbp), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_sprintf
	movq	-192(%rbp), %rbx                ## 8-byte Reload
	leaq	L_.str.2(%rip), %rdi
	leaq	-112(%rbp), %rsi
	callq	_GUI_WaitPrompt
	movl	%r14d, %edi
	callq	_CARD_Unmount
	movq	%rbx, %rdi
	callq	_free
LBB0_43:
	movq	%r13, %rdi
LBB0_44:
	callq	_free
LBB0_45:
	xorl	%r15d, %r15d
LBB0_46:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_52
## %bb.47:
	movl	%r15d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_48:
	leaq	-236(%rbp), %rdi
	callq	_time
	movl	-224(%rbp), %esi
	leaq	-272(%rbp), %r15
	movl	%r14d, %edi
	movq	%r15, %rdx
	callq	_CARD_GetStatus
	movaps	LCPI0_0(%rip), %xmm0            ## xmm0 = [0,2,1,2048]
	movaps	%xmm0, -272(%rbp)
	movl	-236(%rbp), %eax
	movl	%eax, -256(%rbp)
	movl	-224(%rbp), %esi
	movl	%r14d, %edi
	movq	%r15, %rdx
	callq	_CARD_SetStatus
	cmpq	$0, -184(%rbp)
	movq	-192(%rbp), %rbx                ## 8-byte Reload
	je	LBB0_51
## %bb.49:
	movq	-208(%rbp), %rcx
	movq	-216(%rbp), %rdx
	leaq	-232(%rbp), %r15
	.p2align	4, 0x90
LBB0_50:                                ## =>This Inner Loop Header: Depth=1
	leaq	(%rbx,%rcx,4), %rsi
	movq	%r15, %rdi
	callq	_CARD_Write
	movq	-216(%rbp), %rdx
	movq	-208(%rbp), %rcx
	addq	%rdx, %rcx
	subq	%rdx, -184(%rbp)
	movq	%rcx, -208(%rbp)
	jne	LBB0_50
LBB0_51:
	leaq	-232(%rbp), %rdi
	callq	_CARD_Close
	movl	%r14d, %edi
	callq	_CARD_Unmount
	movq	%rbx, %rdi
	callq	_free
	movq	%r13, %rdi
	callq	_free
	xorl	%eax, %eax
	callq	_GUI_MsgBoxClose
	movl	$1, %r15d
	jmp	LBB0_46
LBB0_52:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAXPATHLEN,4,2                 ## @MAXPATHLEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Information"

L_.str.1:                               ## @.str.1
	.asciz	"Saving State ..."

	.comm	_STATE_SIZE,8,3                 ## @STATE_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"Error"

L_.str.3:                               ## @.str.3
	.asciz	"Unable to allocate memory !"

	.comm	_sram,24,3                      ## @sram
L_.str.4:                               ## @.str.4
	.asciz	"Backup RAM disabled !"

L_.str.5:                               ## @.str.5
	.asciz	"Warning"

L_.str.6:                               ## @.str.6
	.asciz	"Backup RAM not modified !"

L_.str.7:                               ## @.str.7
	.asciz	"Saving Backup RAM ..."

L_.str.8:                               ## @.str.8
	.asciz	"%s/saves/%s.gp%d"

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

L_.str.10:                              ## @.str.10
	.asciz	"wb"

L_.str.11:                              ## @.str.11
	.asciz	"Unable to open file !"

	.comm	_CHUNKSIZE,8,3                  ## @CHUNKSIZE
L_.str.12:                              ## @.str.12
	.asciz	"%s/saves/%s__%d.png"

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

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

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

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

L_.str.17:                              ## @.str.17
	.asciz	"Unable to mount memory card"

L_.str.18:                              ## @.str.18
	.asciz	"Invalid sector size (%d)"

	.section	__TEXT,__const
	.p2align	4                               ## @__const.slot_save.comment
l___const.slot_save.comment:
	.asciz	"Genesis Plus GX\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
	.asciz	"SRAM Save\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"

	.comm	_icon,8,3                       ## @icon
	.comm	_CARD_ERROR_READY,8,3           ## @CARD_ERROR_READY
	.section	__TEXT,__cstring,cstring_literals
L_.str.19:                              ## @.str.19
	.asciz	"TEMP"

L_.str.20:                              ## @.str.20
	.asciz	"Unable to increase file size (%d)"

L_.str.21:                              ## @.str.21
	.asciz	"Unable to create file (%d)"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function slot_save
lCPI0_0:
	.long	0                               ; 0x0
	.long	2                               ; 0x2
	.long	1                               ; 0x1
	.long	2048                            ; 0x800
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_slot_save
	.p2align	2
_slot_save:                             ; @slot_save
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	sub	sp, sp, #208
	mov	x22, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
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
	subs	w24, w0, #1
	b.lt	LBB0_13
; %bb.1:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w2, #1
	bl	_GUI_MsgBoxOpen
Lloh12:
	adrp	x8, _STATE_SIZE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _STATE_SIZE@GOTPAGEOFF]
Lloh14:
	ldr	x1, [x8]
	mov	w0, #32
	bl	_memalign
	cbz	x0, LBB0_25
; %bb.2:
	mov	x19, x0
	bl	_state_save
	mov	x23, x0
	stur	x0, [x29, #-216]
	cbz	w22, LBB0_16
; %bb.3:
Lloh15:
	adrp	x8, _rominfo@GOTPAGE
Lloh16:
	ldr	x8, [x8, _rominfo@GOTPAGEOFF]
                                        ; kill: def $w24 killed $w24 killed $x24 def $x24
Lloh17:
	ldr	w8, [x8]
	stp	x8, x24, [sp, #-16]!
Lloh18:
	adrp	x1, l_.str.13@PAGE
Lloh19:
	add	x1, x1, l_.str.13@PAGEOFF
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #16
LBB0_4:
Lloh20:
	adrp	x8, _CARD_WORKAREA@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CARD_WORKAREA@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
Lloh23:
	adrp	x0, _SysArea@GOTPAGE
Lloh24:
	ldr	x0, [x0, _SysArea@GOTPAGEOFF]
	mov	w1, #0
	bl	_memset
Lloh25:
	adrp	x0, l_.str.15@PAGE
Lloh26:
	add	x0, x0, l_.str.15@PAGEOFF
Lloh27:
	adrp	x1, l_.str.16@PAGE
Lloh28:
	add	x1, x1, l_.str.16@PAGEOFF
	bl	_CARD_Init
	sub	w21, w22, #1
	mov	x0, x21
	bl	_CardMount
	cbz	w0, LBB0_27
; %bb.5:
	stur	xzr, [x29, #-232]
	sub	x1, x29, #232
	mov	x0, x21
	bl	_CARD_GetSectorSize
                                        ; kill: def $w0 killed $w0 def $x0
	ldur	x8, [x29, #-232]
	cbz	x8, LBB0_28
; %bb.6:
	add	x1, x23, #2116
	mov	w0, #32
	bl	_memalign
	cbz	x0, LBB0_34
; %bb.7:
	mov	x22, x0
Lloh29:
	adrp	x8, l___const.slot_save.comment@PAGE
Lloh30:
	add	x8, x8, l___const.slot_save.comment@PAGEOFF
	ldp	q0, q1, [x8]
	stp	q0, q1, [x29, #-208]
	ldp	q0, q1, [x8, #32]
	stp	q0, q1, [x29, #-176]
	sub	x24, x29, #208
	add	x0, x24, #32
	mov	x1, x20
	bl	_strcpy
Lloh31:
	adrp	x8, _icon@GOTPAGE
Lloh32:
	ldr	x8, [x8, _icon@GOTPAGEOFF]
	mov	w9, #2048
	stp	x8, x9, [sp, #-16]!
	mov	x0, x22
	bl	_memcpy
	add	sp, sp, #16
	add	x0, x22, #2, lsl #12            ; =8192
	mov	w8, #64
	stp	x24, x8, [sp, #-16]!
	bl	_memcpy
	add	sp, sp, #16
	stur	x23, [x29, #-224]
	mov	w8, #8448
	add	x0, x22, x8
	mov	w8, #4
	sub	x9, x29, #224
	stp	x9, x8, [sp, #-16]!
	bl	_memcpy
	add	sp, sp, #16
	mov	w8, #8464
	add	x0, x22, x8
	ldur	x3, [x29, #-224]
	sub	x1, x29, #216
	mov	x2, x19
	mov	w4, #9
	bl	_compress2
	ldur	x8, [x29, #-216]
	add	x10, x8, #2116
	stur	x10, [x29, #-216]
	ldur	x8, [x29, #-232]
	udiv	x9, x10, x8
	msub	x10, x9, x8, x10
	cbz	x10, LBB0_9
; %bb.8:
	madd	x8, x8, x9, x8
	stur	x8, [x29, #-216]
LBB0_9:
	sub	x2, x29, #248
	mov	x0, x21
	mov	x1, x20
	bl	_CARD_Open
Lloh33:
	adrp	x8, _CARD_ERROR_READY@GOTPAGE
Lloh34:
	ldr	x8, [x8, _CARD_ERROR_READY@GOTPAGEOFF]
Lloh35:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_39
; %bb.10:
	ldur	x8, [x29, #-216]
	ldur	x9, [x29, #-248]
	sub	x23, x8, x9
	sub	x0, x29, #248
	bl	_CARD_Close
	sub	x0, x29, #248
	mov	w1, #0
	mov	w2, #16
	bl	_memset
	cmp	w23, #1
	b.lt	LBB0_38
; %bb.11:
	sxtw	x2, w23
Lloh36:
	adrp	x1, l_.str.19@PAGE
Lloh37:
	add	x1, x1, l_.str.19@PAGEOFF
	sub	x3, x29, #248
	mov	x0, x21
	bl	_CARD_Create
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_37
; %bb.12:
	str	x0, [sp, #-16]!
Lloh38:
	adrp	x1, l_.str.20@PAGE
Lloh39:
	add	x1, x1, l_.str.20@PAGEOFF
	b	LBB0_41
LBB0_13:
Lloh40:
	adrp	x23, _sram@GOTPAGE
Lloh41:
	ldr	x23, [x23, _sram@GOTPAGEOFF]
	ldr	w8, [x23, #16]
	cbz	w8, LBB0_21
; %bb.14:
	ldr	x1, [x23]
	mov	w0, #0
	mov	w2, #65536
	bl	_crc32
	ldr	x8, [x23, #8]
	cmp	x0, x8
	b.ne	LBB0_22
; %bb.15:
Lloh42:
	adrp	x0, l_.str.5@PAGE
Lloh43:
	add	x0, x0, l_.str.5@PAGEOFF
Lloh44:
	adrp	x1, l_.str.6@PAGE
Lloh45:
	add	x1, x1, l_.str.6@PAGEOFF
	b	LBB0_26
LBB0_16:
Lloh46:
	adrp	x8, _DEFAULT_PATH@GOTPAGE
Lloh47:
	ldr	x8, [x8, _DEFAULT_PATH@GOTPAGEOFF]
Lloh48:
	ldr	x8, [x8]
Lloh49:
	adrp	x9, _rom_filename@GOTPAGE
Lloh50:
	ldr	x9, [x9, _rom_filename@GOTPAGEOFF]
Lloh51:
	ldr	x9, [x9]
	sub	sp, sp, #32
	stp	x9, x24, [sp, #8]
	str	x8, [sp]
Lloh52:
	adrp	x1, l_.str.8@PAGE
Lloh53:
	add	x1, x1, l_.str.8@PAGEOFF
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #32
LBB0_17:
Lloh54:
	adrp	x1, l_.str.10@PAGE
Lloh55:
	add	x1, x1, l_.str.10@PAGEOFF
	mov	x0, x20
	bl	_fopen
	cbz	x0, LBB0_29
; %bb.18:
	mov	x22, x0
Lloh56:
	adrp	x24, _CHUNKSIZE@GOTPAGE
Lloh57:
	ldr	x24, [x24, _CHUNKSIZE@GOTPAGEOFF]
	ldr	x1, [x24]
	cmp	x23, x1
	b.ls	LBB0_31
; %bb.19:
	mov	x25, #0
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	add	x0, x19, x25, lsl #2
	mov	w2, #1
	mov	x3, x22
	bl	_fwrite
	ldr	x1, [x24]
	add	x25, x25, x1
	sub	x23, x23, x1
	cmp	x23, x1
	b.hi	LBB0_20
	b	LBB0_32
LBB0_21:
Lloh58:
	adrp	x0, l_.str.2@PAGE
Lloh59:
	add	x0, x0, l_.str.2@PAGEOFF
Lloh60:
	adrp	x1, l_.str.4@PAGE
Lloh61:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_26
LBB0_22:
Lloh62:
	adrp	x0, l_.str@PAGE
Lloh63:
	add	x0, x0, l_.str@PAGEOFF
Lloh64:
	adrp	x1, l_.str.7@PAGE
Lloh65:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	w2, #1
	bl	_GUI_MsgBoxOpen
	mov	w0, #32
	mov	w1, #65536
	bl	_memalign
	cbz	x0, LBB0_25
; %bb.23:
	mov	x19, x0
	ldr	x8, [x23]
	mov	w24, #65536
	stp	x8, x24, [sp, #-16]!
	bl	_memcpy
	add	sp, sp, #16
	stur	x24, [x29, #-216]
	ldr	x1, [x23]
	mov	w0, #0
	mov	w2, #65536
	bl	_crc32
	str	x0, [x23, #8]
	cbz	w22, LBB0_36
; %bb.24:
Lloh66:
	adrp	x8, _rominfo@GOTPAGE
Lloh67:
	ldr	x8, [x8, _rominfo@GOTPAGEOFF]
Lloh68:
	ldr	w8, [x8]
	str	x8, [sp, #-16]!
Lloh69:
	adrp	x1, l_.str.14@PAGE
Lloh70:
	add	x1, x1, l_.str.14@PAGEOFF
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #16
	mov	w23, #65536
	b	LBB0_4
LBB0_25:
Lloh71:
	adrp	x0, l_.str.2@PAGE
Lloh72:
	add	x0, x0, l_.str.2@PAGEOFF
Lloh73:
	adrp	x1, l_.str.3@PAGE
Lloh74:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_26:
	bl	_GUI_WaitPrompt
	mov	w24, #0
	b	LBB0_48
LBB0_27:
Lloh75:
	adrp	x0, l_.str.2@PAGE
Lloh76:
	add	x0, x0, l_.str.2@PAGEOFF
Lloh77:
	adrp	x1, l_.str.17@PAGE
Lloh78:
	add	x1, x1, l_.str.17@PAGEOFF
	b	LBB0_30
LBB0_28:
	str	x0, [sp, #-16]!
Lloh79:
	adrp	x1, l_.str.18@PAGE
Lloh80:
	add	x1, x1, l_.str.18@PAGEOFF
	sub	x0, x29, #136
	bl	_sprintf
	add	sp, sp, #16
Lloh81:
	adrp	x0, l_.str.2@PAGE
Lloh82:
	add	x0, x0, l_.str.2@PAGEOFF
	sub	x1, x29, #136
	b	LBB0_35
LBB0_29:
Lloh83:
	adrp	x0, l_.str.2@PAGE
Lloh84:
	add	x0, x0, l_.str.2@PAGEOFF
Lloh85:
	adrp	x1, l_.str.11@PAGE
Lloh86:
	add	x1, x1, l_.str.11@PAGEOFF
LBB0_30:
	bl	_GUI_WaitPrompt
	b	LBB0_42
LBB0_31:
	mov	x25, #0
LBB0_32:
	stur	x25, [x29, #-224]
	add	x0, x19, x25, lsl #2
	mov	w24, #1
	mov	x1, x23
	mov	w2, #1
	mov	x3, x22
	bl	_fwrite
	mov	x0, x22
	bl	_fclose
	mov	x0, x19
	bl	_free
	bl	_GUI_MsgBoxClose
	subs	w8, w21, #1
	b.lt	LBB0_48
; %bb.33:
Lloh87:
	adrp	x9, _DEFAULT_PATH@GOTPAGE
Lloh88:
	ldr	x9, [x9, _DEFAULT_PATH@GOTPAGEOFF]
Lloh89:
	ldr	x9, [x9]
Lloh90:
	adrp	x10, _rom_filename@GOTPAGE
Lloh91:
	ldr	x10, [x10, _rom_filename@GOTPAGEOFF]
Lloh92:
	ldr	x10, [x10]
	sub	sp, sp, #32
	stp	x10, x8, [sp, #8]
	str	x9, [sp]
Lloh93:
	adrp	x1, l_.str.12@PAGE
Lloh94:
	add	x1, x1, l_.str.12@PAGEOFF
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #32
	mov	x0, x20
	bl	_gxSaveScreenshot
	b	LBB0_47
LBB0_34:
Lloh95:
	adrp	x0, l_.str.2@PAGE
Lloh96:
	add	x0, x0, l_.str.2@PAGEOFF
Lloh97:
	adrp	x1, l_.str.3@PAGE
Lloh98:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_35:
	bl	_GUI_WaitPrompt
	mov	x0, x21
	bl	_CARD_Unmount
	b	LBB0_42
LBB0_36:
Lloh99:
	adrp	x8, _DEFAULT_PATH@GOTPAGE
Lloh100:
	ldr	x8, [x8, _DEFAULT_PATH@GOTPAGEOFF]
Lloh101:
	ldr	x8, [x8]
Lloh102:
	adrp	x9, _rom_filename@GOTPAGE
Lloh103:
	ldr	x9, [x9, _rom_filename@GOTPAGEOFF]
Lloh104:
	ldr	x9, [x9]
	stp	x8, x9, [sp, #-16]!
Lloh105:
	adrp	x1, l_.str.9@PAGE
Lloh106:
	add	x1, x1, l_.str.9@PAGEOFF
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #16
	mov	w23, #65536
	b	LBB0_17
LBB0_37:
	sub	x0, x29, #248
	bl	_CARD_Close
	sub	x0, x29, #248
	mov	w1, #0
	mov	w2, #16
	bl	_memset
Lloh107:
	adrp	x1, l_.str.19@PAGE
Lloh108:
	add	x1, x1, l_.str.19@PAGEOFF
	mov	x0, x21
	bl	_CARD_Delete
LBB0_38:
	mov	x0, x21
	mov	x1, x20
	bl	_CARD_Delete
LBB0_39:
	ldur	x2, [x29, #-216]
	sub	x3, x29, #248
	mov	x0, x21
	mov	x1, x20
	bl	_CARD_Create
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_43
; %bb.40:
	str	x0, [sp, #-16]!
Lloh109:
	adrp	x1, l_.str.21@PAGE
Lloh110:
	add	x1, x1, l_.str.21@PAGEOFF
LBB0_41:
	sub	x0, x29, #136
	bl	_sprintf
	add	sp, sp, #16
Lloh111:
	adrp	x0, l_.str.2@PAGE
Lloh112:
	add	x0, x0, l_.str.2@PAGEOFF
	sub	x1, x29, #136
	bl	_GUI_WaitPrompt
	mov	x0, x21
	bl	_CARD_Unmount
	mov	x0, x22
	bl	_free
LBB0_42:
	mov	x0, x19
	bl	_free
	mov	w24, #0
	b	LBB0_48
LBB0_43:
	sub	x0, x29, #252
	bl	_time
	ldur	w1, [x29, #-240]
	sub	x2, x29, #272
	mov	x0, x21
	bl	_CARD_GetStatus
Lloh113:
	adrp	x8, lCPI0_0@PAGE
Lloh114:
	ldr	q0, [x8, lCPI0_0@PAGEOFF]
	sub	x8, x29, #16
	stur	q0, [x8, #-256]
	ldur	w8, [x29, #-252]
	stur	w8, [x29, #-256]
	ldur	w1, [x29, #-240]
	sub	x2, x29, #272
	mov	x0, x21
	bl	_CARD_SetStatus
	ldur	x8, [x29, #-216]
	cbz	x8, LBB0_46
; %bb.44:
	ldp	x2, x3, [x29, #-232]
LBB0_45:                                ; =>This Inner Loop Header: Depth=1
	add	x1, x22, x3, lsl #2
	sub	x0, x29, #248
	bl	_CARD_Write
	ldp	x2, x9, [x29, #-232]
	ldur	x8, [x29, #-216]
	add	x3, x9, x2
	subs	x8, x8, x2
	stp	x3, x8, [x29, #-224]
	b.ne	LBB0_45
LBB0_46:
	sub	x0, x29, #248
	bl	_CARD_Close
	mov	x0, x21
	bl	_CARD_Unmount
	mov	x0, x22
	bl	_free
	mov	x0, x19
	bl	_free
	bl	_GUI_MsgBoxClose
LBB0_47:
	mov	w24, #1
LBB0_48:
	ldur	x8, [x29, #-72]
Lloh115:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh116:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh117:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_50
; %bb.49:
	mov	x0, x24
	sub	sp, x29, #64
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_50:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpAdd	Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpLdrGot	Lloh56, Lloh57
	.loh AdrpAdd	Lloh60, Lloh61
	.loh AdrpAdd	Lloh58, Lloh59
	.loh AdrpAdd	Lloh64, Lloh65
	.loh AdrpAdd	Lloh62, Lloh63
	.loh AdrpAdd	Lloh69, Lloh70
	.loh AdrpLdrGotLdr	Lloh66, Lloh67, Lloh68
	.loh AdrpAdd	Lloh73, Lloh74
	.loh AdrpAdd	Lloh71, Lloh72
	.loh AdrpAdd	Lloh77, Lloh78
	.loh AdrpAdd	Lloh75, Lloh76
	.loh AdrpAdd	Lloh81, Lloh82
	.loh AdrpAdd	Lloh79, Lloh80
	.loh AdrpAdd	Lloh85, Lloh86
	.loh AdrpAdd	Lloh83, Lloh84
	.loh AdrpAdd	Lloh93, Lloh94
	.loh AdrpLdrGotLdr	Lloh90, Lloh91, Lloh92
	.loh AdrpLdrGotLdr	Lloh87, Lloh88, Lloh89
	.loh AdrpAdd	Lloh97, Lloh98
	.loh AdrpAdd	Lloh95, Lloh96
	.loh AdrpAdd	Lloh105, Lloh106
	.loh AdrpLdrGotLdr	Lloh102, Lloh103, Lloh104
	.loh AdrpLdrGotLdr	Lloh99, Lloh100, Lloh101
	.loh AdrpAdd	Lloh107, Lloh108
	.loh AdrpAdd	Lloh109, Lloh110
	.loh AdrpAdd	Lloh111, Lloh112
	.loh AdrpLdr	Lloh113, Lloh114
	.loh AdrpLdrGotLdr	Lloh115, Lloh116, Lloh117
	.cfi_endproc
                                        ; -- End function
	.comm	_MAXPATHLEN,4,2                 ; @MAXPATHLEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Information"

l_.str.1:                               ; @.str.1
	.asciz	"Saving State ..."

	.comm	_STATE_SIZE,8,3                 ; @STATE_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"Error"

l_.str.3:                               ; @.str.3
	.asciz	"Unable to allocate memory !"

	.comm	_sram,24,3                      ; @sram
l_.str.4:                               ; @.str.4
	.asciz	"Backup RAM disabled !"

l_.str.5:                               ; @.str.5
	.asciz	"Warning"

l_.str.6:                               ; @.str.6
	.asciz	"Backup RAM not modified !"

l_.str.7:                               ; @.str.7
	.asciz	"Saving Backup RAM ..."

l_.str.8:                               ; @.str.8
	.asciz	"%s/saves/%s.gp%d"

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

l_.str.10:                              ; @.str.10
	.asciz	"wb"

l_.str.11:                              ; @.str.11
	.asciz	"Unable to open file !"

	.comm	_CHUNKSIZE,8,3                  ; @CHUNKSIZE
l_.str.12:                              ; @.str.12
	.asciz	"%s/saves/%s__%d.png"

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

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

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

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

l_.str.17:                              ; @.str.17
	.asciz	"Unable to mount memory card"

l_.str.18:                              ; @.str.18
	.asciz	"Invalid sector size (%d)"

	.section	__TEXT,__const
l___const.slot_save.comment:            ; @__const.slot_save.comment
	.asciz	"Genesis Plus GX\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
	.asciz	"SRAM Save\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"

	.comm	_icon,8,3                       ; @icon
	.comm	_CARD_ERROR_READY,8,3           ; @CARD_ERROR_READY
	.section	__TEXT,__cstring,cstring_literals
l_.str.19:                              ; @.str.19
	.asciz	"TEMP"

l_.str.20:                              ; @.str.20
	.asciz	"Unable to increase file size (%d)"

l_.str.21:                              ; @.str.21
	.asciz	"Unable to create file (%d)"

.subsections_via_symbols
