	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function RunEvents
_RunEvents:                             ## @RunEvents
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	testl	$6144, %edi                     ## imm = 0x1800
	je	LBB0_20
## %bb.1:
	movq	_state_slot@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_emu_check_save_file
	movl	%r14d, %r15d
	andl	$4096, %r15d                    ## imm = 0x1000
	testq	%rax, %rax
	je	LBB0_15
## %bb.2:
	movq	_currentConfig@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%r15d, %r15d
	jne	LBB0_5
## %bb.3:
	testl	$512, %eax                      ## imm = 0x200
	je	LBB0_16
## %bb.4:
	leaq	L_.str.2(%rip), %rbx
	jmp	LBB0_8
LBB0_5:
	testl	$2048, %eax                     ## imm = 0x800
	je	LBB0_17
## %bb.7:
	leaq	L_.str.1(%rip), %rbx
LBB0_8:
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_sceGuSync
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_blit2
	movl	$1, %edi
	callq	_psp_pad_read
	movl	%eax, %ebx
	movq	_PBTN_X@GOTPCREL(%rip), %r12
	movq	_PBTN_CIRCLE@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %eax
	movl	(%r12), %ecx
	orl	%eax, %ecx
	testl	%ebx, %ecx
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	$50, %edi
	callq	_psp_msleep
	movl	$1, %edi
	callq	_psp_pad_read
	movl	%eax, %ebx
	jmp	LBB0_9
LBB0_11:
	andl	%eax, %ebx
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	$1, %edi
	callq	_psp_pad_read
	movl	(%r13), %ecx
	orl	(%r12), %ecx
	testl	%eax, %ecx
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	$50, %edi
	callq	_psp_msleep
	jmp	LBB0_12
LBB0_14:
	xorl	%edi, %edi
	callq	_clearArea
	testl	%ebx, %ebx
	jne	LBB0_19
LBB0_15:
	testl	%r15d, %r15d
	jne	LBB0_17
LBB0_16:
	leaq	L_.str.4(%rip), %rsi
	xorl	%r15d, %r15d
	jmp	LBB0_18
LBB0_17:
	leaq	L_.str.3(%rip), %rsi
LBB0_18:
	movl	$4, %edi
	movl	$1, %edx
	xorl	%ecx, %ecx
	callq	_osd_text
	movq	_emu_msg_cb@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_PicoStateProgressCB@GOTPCREL(%rip), %rbx
	movq	%rax, (%rbx)
	shrl	$12, %r15d
	movl	%r15d, %edi
	xorl	%esi, %esi
	callq	_emu_save_load_game
	movq	$0, (%rbx)
	xorl	%edi, %edi
	callq	_psp_msleep
LBB0_19:
	movq	_reset_timing@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_20:
	testl	$1024, %r14d                    ## imm = 0x400
	je	LBB0_29
## %bb.21:
	movq	_PicoOpt@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	testb	$16, %al
	jne	LBB0_23
## %bb.22:
	orl	$16, %eax
	movl	%eax, (%rbx)
	movq	_currentConfig@GOTPCREL(%rip), %rcx
	movl	$-129, %eax
	andl	(%rcx), %eax
	jmp	LBB0_24
LBB0_23:
	andl	$-17, %eax
	movl	%eax, (%rbx)
	movq	_currentConfig@GOTPCREL(%rip), %rcx
	movl	$128, %eax
	orl	(%rcx), %eax
LBB0_24:
	movq	_currentConfig@GOTPCREL(%rip), %r15
	movl	%eax, (%r15)
	xorl	%eax, %eax
	callq	_vidResetMode
	movq	_POPT_ALT_RENDERER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_26
## %bb.25:
	leaq	L_.str.5(%rip), %rdi
	jmp	LBB0_28
LBB0_26:
	testb	$-128, (%r15)
	je	LBB0_29
## %bb.27:
	leaq	L_.str.6(%rip), %rdi
LBB0_28:
	xorl	%eax, %eax
	callq	_emu_status_msg
LBB0_29:
	testl	$768, %r14d                     ## imm = 0x300
	je	LBB0_32
## %bb.30:
	movq	_state_slot@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	testl	$512, %r14d                     ## imm = 0x200
	jne	LBB0_33
## %bb.31:
	leal	1(%rcx), %edx
	xorl	%ebx, %ebx
	cmpl	$9, %ecx
	cmovll	%edx, %ebx
	jmp	LBB0_34
LBB0_32:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_33:
	leal	-1(%rcx), %edx
	testl	%ecx, %ecx
	movl	$9, %ebx
	cmovgl	%edx, %ebx
LBB0_34:
	movl	%ebx, (%rax)
	movl	%ebx, %edi
	callq	_emu_check_save_file
	testq	%rax, %rax
	leaq	L_.str.9(%rip), %rax
	leaq	L_.str.8(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str.7(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_emu_status_msg                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_state_slot,4,2                 ## @state_slot
	.comm	_currentConfig,4,2              ## @currentConfig
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.space	1

L_.str.1:                               ## @.str.1
	.asciz	"LOAD STATE? (X=yes, O=no)"

L_.str.2:                               ## @.str.2
	.asciz	"OVERWRITE SAVE? (X=yes, O=no)"

	.comm	_PBTN_X,4,2                     ## @PBTN_X
	.comm	_PBTN_CIRCLE,4,2                ## @PBTN_CIRCLE
L_.str.3:                               ## @.str.3
	.asciz	"LOADING GAME"

L_.str.4:                               ## @.str.4
	.asciz	"SAVING GAME"

	.comm	_emu_msg_cb,8,3                 ## @emu_msg_cb
	.comm	_PicoStateProgressCB,8,3        ## @PicoStateProgressCB
	.comm	_reset_timing,4,2               ## @reset_timing
	.comm	_PicoOpt,4,2                    ## @PicoOpt
	.comm	_POPT_ALT_RENDERER,4,2          ## @POPT_ALT_RENDERER
L_.str.5:                               ## @.str.5
	.asciz	"fast renderer"

L_.str.6:                               ## @.str.6
	.asciz	"accurate renderer"

L_.str.7:                               ## @.str.7
	.asciz	"SAVE SLOT %i [%s]"

L_.str.8:                               ## @.str.8
	.asciz	"USED"

L_.str.9:                               ## @.str.9
	.asciz	"FREE"

	.no_dead_strip	_RunEvents
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function RunEvents
_RunEvents:                             ; @RunEvents
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x19, x0
Lloh0:
	adrp	x21, _state_slot@GOTPAGE
Lloh1:
	ldr	x21, [x21, _state_slot@GOTPAGEOFF]
	tst	w0, #0x1800
	b.eq	LBB0_19
; %bb.1:
	ldr	w0, [x21]
	bl	_emu_check_save_file
	and	w22, w19, #0x1000
	cbz	x0, LBB0_14
; %bb.2:
Lloh2:
	adrp	x8, _currentConfig@GOTPAGE
Lloh3:
	ldr	x8, [x8, _currentConfig@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cbnz	w22, LBB0_5
; %bb.3:
	tbz	w8, #9, LBB0_15
; %bb.4:
Lloh5:
	adrp	x20, l_.str.2@PAGE
Lloh6:
	add	x20, x20, l_.str.2@PAGEOFF
	b	LBB0_7
LBB0_5:
	tbz	w8, #11, LBB0_16
; %bb.6:
Lloh7:
	adrp	x20, l_.str.1@PAGE
Lloh8:
	add	x20, x20, l_.str.1@PAGEOFF
LBB0_7:
	mov	w0, #0
	mov	w1, #0
	bl	_sceGuSync
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	mov	w2, #0
	bl	_blit2
	mov	w0, #1
	bl	_psp_pad_read
Lloh11:
	adrp	x20, _PBTN_X@GOTPAGE
Lloh12:
	ldr	x20, [x20, _PBTN_X@GOTPAGEOFF]
	ldr	w9, [x20]
Lloh13:
	adrp	x23, _PBTN_CIRCLE@GOTPAGE
Lloh14:
	ldr	x23, [x23, _PBTN_CIRCLE@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x23]
	orr	w9, w8, w9
	tst	w9, w0
	b.ne	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	w0, #50
	bl	_psp_msleep
	mov	w0, #1
	bl	_psp_pad_read
	ldr	w9, [x20]
	b	LBB0_8
LBB0_10:
	and	w24, w8, w0
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	mov	w0, #1
	bl	_psp_pad_read
	ldr	w8, [x20]
	ldr	w9, [x23]
	orr	w8, w9, w8
	tst	w8, w0
	b.eq	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w0, #50
	bl	_psp_msleep
	b	LBB0_11
LBB0_13:
	mov	w0, #0
	bl	_clearArea
	cbnz	w24, LBB0_18
LBB0_14:
	cbnz	w22, LBB0_16
LBB0_15:
	mov	w22, #0
Lloh15:
	adrp	x1, l_.str.4@PAGE
Lloh16:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_17
LBB0_16:
Lloh17:
	adrp	x1, l_.str.3@PAGE
Lloh18:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_17:
	mov	w0, #4
	mov	w2, #1
	mov	w3, #0
	bl	_osd_text
Lloh19:
	adrp	x8, _emu_msg_cb@GOTPAGE
Lloh20:
	ldr	x8, [x8, _emu_msg_cb@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
Lloh22:
	adrp	x20, _PicoStateProgressCB@GOTPAGE
Lloh23:
	ldr	x20, [x20, _PicoStateProgressCB@GOTPAGEOFF]
	str	x8, [x20]
	lsr	w0, w22, #12
	mov	w1, #0
	bl	_emu_save_load_game
	str	xzr, [x20]
	mov	w0, #0
	bl	_psp_msleep
LBB0_18:
Lloh24:
	adrp	x8, _reset_timing@GOTPAGE
Lloh25:
	ldr	x8, [x8, _reset_timing@GOTPAGEOFF]
	mov	w9, #1
Lloh26:
	str	w9, [x8]
LBB0_19:
	tbz	w19, #10, LBB0_28
; %bb.20:
Lloh27:
	adrp	x20, _PicoOpt@GOTPAGE
Lloh28:
	ldr	x20, [x20, _PicoOpt@GOTPAGEOFF]
	ldr	w8, [x20]
	tbnz	w8, #4, LBB0_22
; %bb.21:
	orr	w8, w8, #0x10
	str	w8, [x20]
Lloh29:
	adrp	x8, _currentConfig@GOTPAGE
Lloh30:
	ldr	x8, [x8, _currentConfig@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	and	w8, w8, #0xffffff7f
	b	LBB0_23
LBB0_22:
	and	w8, w8, #0xffffffef
	str	w8, [x20]
Lloh32:
	adrp	x8, _currentConfig@GOTPAGE
Lloh33:
	ldr	x8, [x8, _currentConfig@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	orr	w8, w8, #0x80
LBB0_23:
Lloh35:
	adrp	x22, _currentConfig@GOTPAGE
Lloh36:
	ldr	x22, [x22, _currentConfig@GOTPAGEOFF]
	str	w8, [x22]
	bl	_vidResetMode
	ldr	w8, [x20]
Lloh37:
	adrp	x9, _POPT_ALT_RENDERER@GOTPAGE
Lloh38:
	ldr	x9, [x9, _POPT_ALT_RENDERER@GOTPAGEOFF]
Lloh39:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_25
; %bb.24:
Lloh40:
	adrp	x0, l_.str.5@PAGE
Lloh41:
	add	x0, x0, l_.str.5@PAGEOFF
	b	LBB0_27
LBB0_25:
	ldrb	w8, [x22]
	tbz	w8, #7, LBB0_28
; %bb.26:
Lloh42:
	adrp	x0, l_.str.6@PAGE
Lloh43:
	add	x0, x0, l_.str.6@PAGEOFF
LBB0_27:
	bl	_emu_status_msg
LBB0_28:
	tst	w19, #0x300
	b.eq	LBB0_30
; %bb.29:
	ldr	w8, [x21]
	cmp	w8, #8
	csinc	w9, wzr, w8, gt
	subs	w8, w8, #1
	mov	w10, #9
	csel	w8, w10, w8, lt
	tst	w19, #0x200
	csel	w19, w9, w8, eq
	str	w19, [x21]
	mov	x0, x19
	bl	_emu_check_save_file
Lloh44:
	adrp	x8, l_.str.8@PAGE
Lloh45:
	add	x8, x8, l_.str.8@PAGEOFF
Lloh46:
	adrp	x9, l_.str.9@PAGE
Lloh47:
	add	x9, x9, l_.str.9@PAGEOFF
	cmp	x0, #0
	csel	x8, x9, x8, eq
	stp	x19, x8, [sp]
Lloh48:
	adrp	x0, l_.str.7@PAGE
Lloh49:
	add	x0, x0, l_.str.7@PAGEOFF
	bl	_emu_status_msg
LBB0_30:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotStr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpAdd	Lloh44, Lloh45
	.cfi_endproc
                                        ; -- End function
	.comm	_state_slot,4,2                 ; @state_slot
	.comm	_currentConfig,4,2              ; @currentConfig
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.space	1

l_.str.1:                               ; @.str.1
	.asciz	"LOAD STATE? (X=yes, O=no)"

l_.str.2:                               ; @.str.2
	.asciz	"OVERWRITE SAVE? (X=yes, O=no)"

	.comm	_PBTN_X,4,2                     ; @PBTN_X
	.comm	_PBTN_CIRCLE,4,2                ; @PBTN_CIRCLE
l_.str.3:                               ; @.str.3
	.asciz	"LOADING GAME"

l_.str.4:                               ; @.str.4
	.asciz	"SAVING GAME"

	.comm	_emu_msg_cb,8,3                 ; @emu_msg_cb
	.comm	_PicoStateProgressCB,8,3        ; @PicoStateProgressCB
	.comm	_reset_timing,4,2               ; @reset_timing
	.comm	_PicoOpt,4,2                    ; @PicoOpt
	.comm	_POPT_ALT_RENDERER,4,2          ; @POPT_ALT_RENDERER
l_.str.5:                               ; @.str.5
	.asciz	"fast renderer"

l_.str.6:                               ; @.str.6
	.asciz	"accurate renderer"

l_.str.7:                               ; @.str.7
	.asciz	"SAVE SLOT %i [%s]"

l_.str.8:                               ; @.str.8
	.asciz	"USED"

l_.str.9:                               ; @.str.9
	.asciz	"FREE"

	.no_dead_strip	_RunEvents
.subsections_via_symbols
