	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function draw_savestate_bg
_draw_savestate_bg:                     ## @draw_savestate_bg
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %edx
	movl	$1, %edi
	xorl	%esi, %esi
	callq	_emu_GetSaveFName
	testq	%rax, %rax
	je	LBB0_11
## %bb.1:
	movq	%rax, %rbx
	xorl	%eax, %eax
	callq	_get_oldstate_for_preview
	testq	%rax, %rax
	je	LBB0_11
## %bb.2:
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_strlen
	cltq
	leaq	(%rbx,%rax), %rdi
	addq	$-3, %rdi
	leaq	L_.str(%rip), %rsi
	callq	_strcmp
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	callq	_fopen
	movq	%rax, %rbx
	xorl	%edi, %edi
	jmp	LBB0_5
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	callq	_gzopen
	movq	%rax, %rbx
	movl	$1, %edi
LBB0_5:
	callq	_emu_setSaveStateCbs
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.6:
	movq	_PicoAHW@GOTPCREL(%rip), %rax
	movq	_PAHW_MCD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_8
## %bb.7:
	movq	%rbx, %rdi
	callq	_PicoCdLoadStateGfx
	jmp	LBB0_9
LBB0_8:
	movq	_SEEK_SET@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	%rbx, %rdi
	movl	$65568, %esi                    ## imm = 0x10020
	callq	_areaSeek
	movq	_Pico@GOTPCREL(%rip), %r15
	movq	24(%r15), %rdi
	movl	$1, %esi
	movl	$8, %edx
	movq	%rbx, %rcx
	callq	_areaRead
	movq	_SEEK_CUR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	$8192, %esi                     ## imm = 0x2000
	callq	_areaSeek
	movq	16(%r15), %rdi
	movl	$1, %esi
	movl	$8, %edx
	movq	%rbx, %rcx
	callq	_areaRead
	movq	8(%r15), %rdi
	movl	$1, %esi
	movl	$8, %edx
	movq	%rbx, %rcx
	callq	_areaRead
	movl	(%r12), %edx
	movq	%rbx, %rdi
	movl	$139680, %esi                   ## imm = 0x221A0
	callq	_areaSeek
	movq	%r15, %rdi
	movl	$1, %esi
	movl	$4, %edx
	movq	%rbx, %rcx
	callq	_areaRead
LBB0_9:
	movq	%rbx, %rdi
	callq	_areaClose
LBB0_10:
	xorl	%edi, %edi
	callq	_emu_forcedFrame
	movl	$1, %edi
	xorl	%esi, %esi
	callq	_menu_prepare_bg
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_restore_oldstate               ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	".gz"

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

	.comm	_PicoAHW,4,2                    ## @PicoAHW
	.comm	_PAHW_MCD,4,2                   ## @PAHW_MCD
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_Pico,32,3                      ## @Pico
	.comm	_SEEK_CUR,4,2                   ## @SEEK_CUR
	.no_dead_strip	_draw_savestate_bg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function draw_savestate_bg
_draw_savestate_bg:                     ; @draw_savestate_bg
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x2, x0
	mov	w0, #1
	mov	w1, #0
	bl	_emu_GetSaveFName
	cbz	x0, LBB0_4
; %bb.1:
	mov	x20, x0
	bl	_get_oldstate_for_preview
	cbz	x0, LBB0_4
; %bb.2:
	mov	x19, x0
	mov	x0, x20
	bl	_strlen
	add	x8, x20, w0, sxtw
	sub	x0, x8, #3
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_strcmp
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	cbz	x0, LBB0_5
; %bb.3:
	mov	x0, x20
	bl	_fopen
	mov	x20, x0
	mov	w0, #0
	bl	_emu_setSaveStateCbs
	cbnz	x20, LBB0_6
	b	LBB0_10
LBB0_4:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_5:
	mov	x0, x20
	bl	_gzopen
	mov	x20, x0
	mov	w0, #1
	bl	_emu_setSaveStateCbs
	cbz	x20, LBB0_10
LBB0_6:
Lloh4:
	adrp	x8, _PicoAHW@GOTPAGE
Lloh5:
	ldr	x8, [x8, _PicoAHW@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
Lloh7:
	adrp	x9, _PAHW_MCD@GOTPAGE
Lloh8:
	ldr	x9, [x9, _PAHW_MCD@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_PicoCdLoadStateGfx
	b	LBB0_9
LBB0_8:
Lloh10:
	adrp	x22, _SEEK_SET@GOTPAGE
Lloh11:
	ldr	x22, [x22, _SEEK_SET@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x0, x20
	mov	w1, #32
	movk	w1, #1, lsl #16
	bl	_areaSeek
Lloh12:
	adrp	x21, _Pico@GOTPAGE
Lloh13:
	ldr	x21, [x21, _Pico@GOTPAGEOFF]
	ldr	x0, [x21, #24]
	mov	w1, #1
	mov	w2, #8
	mov	x3, x20
	bl	_areaRead
Lloh14:
	adrp	x8, _SEEK_CUR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SEEK_CUR@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x0, x20
	mov	w1, #8192
	bl	_areaSeek
	ldr	x0, [x21, #16]
	mov	w1, #1
	mov	w2, #8
	mov	x3, x20
	bl	_areaRead
	ldr	x0, [x21, #8]
	mov	w1, #1
	mov	w2, #8
	mov	x3, x20
	bl	_areaRead
	ldr	w2, [x22]
	mov	x0, x20
	mov	w1, #8608
	movk	w1, #2, lsl #16
	bl	_areaSeek
	mov	x0, x21
	mov	w1, #1
	mov	w2, #4
	mov	x3, x20
	bl	_areaRead
LBB0_9:
	mov	x0, x20
	bl	_areaClose
LBB0_10:
	mov	w0, #0
	bl	_emu_forcedFrame
	mov	w0, #1
	mov	w1, #0
	bl	_menu_prepare_bg
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_restore_oldstate
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	".gz"

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

	.comm	_PicoAHW,4,2                    ; @PicoAHW
	.comm	_PAHW_MCD,4,2                   ; @PAHW_MCD
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_Pico,32,3                      ; @Pico
	.comm	_SEEK_CUR,4,2                   ; @SEEK_CUR
	.no_dead_strip	_draw_savestate_bg
.subsections_via_symbols
