	.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_26
## %bb.1:
	movq	_PsndOut@GOTPCREL(%rip), %r12
	cmpq	$0, (%r12)
	je	LBB0_3
## %bb.2:
	movl	$1, %edi
	callq	_FrameworkAudio_SetPause
LBB0_3:
	movq	_giz_screen@GOTPCREL(%rip), %rbx
	cmpq	$0, (%rbx)
	jne	LBB0_5
## %bb.4:
	movl	$1, %edi
	callq	_fb_lock
	movq	%rax, (%rbx)
LBB0_5:
	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_19
## %bb.6:
	movq	_currentConfig@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%r15d, %r15d
	jne	LBB0_9
## %bb.7:
	testl	$512, %eax                      ## imm = 0x200
	je	LBB0_20
## %bb.8:
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_12
LBB0_9:
	testl	$2048, %eax                     ## imm = 0x800
	je	LBB0_21
## %bb.11:
	leaq	L_.str.1(%rip), %rsi
LBB0_12:
	leaq	L_.str(%rip), %rdi
	callq	_blit
	xorl	%eax, %eax
	callq	_Framework_PollGetButtons
	movl	%eax, %ebx
	movq	_PBTN_PLAY@GOTPCREL(%rip), %r13
	movq	_PBTN_STOP@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %eax
	movl	(%r13), %ecx
	orl	%eax, %ecx
	testl	%ebx, %ecx
	jne	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movl	$50, %edi
	callq	_Sleep
	xorl	%eax, %eax
	callq	_Framework_PollGetButtons
	movl	%eax, %ebx
	jmp	LBB0_13
LBB0_15:
	andl	%eax, %ebx
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_Framework_PollGetButtons
	movl	(%r12), %ecx
	orl	(%r13), %ecx
	testl	%eax, %ecx
	je	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movl	$50, %edi
	callq	_Sleep
	jmp	LBB0_16
LBB0_18:
	xorl	%edi, %edi
	callq	_clearArea
	testl	%ebx, %ebx
	movq	_PsndOut@GOTPCREL(%rip), %r12
	jne	LBB0_23
LBB0_19:
	testl	%r15d, %r15d
	jne	LBB0_21
LBB0_20:
	leaq	L_.str.4(%rip), %rdx
	xorl	%r15d, %r15d
	jmp	LBB0_22
LBB0_21:
	leaq	L_.str.3(%rip), %rdx
LBB0_22:
	movl	$4, %edi
	movl	$232, %esi
	callq	_osd_text
	movq	_emu_stateCb@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	_Sleep
LBB0_23:
	cmpq	$0, (%r12)
	je	LBB0_25
## %bb.24:
	xorl	%edi, %edi
	callq	_FrameworkAudio_SetPause
LBB0_25:
	movq	_reset_timing@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_26:
	testl	$1024, %r14d                    ## imm = 0x400
	je	LBB0_36
## %bb.27:
	movq	_PicoOpt@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	testb	$16, %al
	jne	LBB0_29
## %bb.28:
	orl	$16, %eax
	movl	%eax, (%r15)
	movq	_currentConfig@GOTPCREL(%rip), %rcx
	movl	$-129, %eax
	andl	(%rcx), %eax
	jmp	LBB0_30
LBB0_29:
	andl	$-17, %eax
	movl	%eax, (%r15)
	movq	_currentConfig@GOTPCREL(%rip), %rcx
	movl	$128, %eax
	orl	(%rcx), %eax
LBB0_30:
	movq	_currentConfig@GOTPCREL(%rip), %rbx
	movl	%eax, (%rbx)
	xorl	%eax, %eax
	callq	_vidResetMode
	testb	$16, (%r15)
	jne	LBB0_33
## %bb.31:
	testb	$-128, (%rbx)
	movq	_noticeMsg@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	jne	LBB0_34
## %bb.32:
	leaq	L_.str.7(%rip), %rsi
	jmp	LBB0_35
LBB0_33:
	movq	_noticeMsg@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_35
LBB0_34:
	leaq	L_.str.6(%rip), %rsi
LBB0_35:
	callq	_strcpy
	xorl	%eax, %eax
	callq	_GetTickCount
	movq	_noticeMsgTime@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
LBB0_36:
	testl	$768, %r14d                     ## imm = 0x300
	je	LBB0_41
## %bb.37:
	movq	_state_slot@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	testl	$512, %r14d                     ## imm = 0x200
	jne	LBB0_39
## %bb.38:
	leal	1(%rcx), %edx
	xorl	%ebx, %ebx
	cmpl	$9, %ecx
	cmovll	%edx, %ebx
	jmp	LBB0_40
LBB0_39:
	leal	-1(%rcx), %edx
	testl	%ecx, %ecx
	movl	$9, %ebx
	cmovgl	%edx, %ebx
LBB0_40:
	movl	%ebx, (%rax)
	movq	_noticeMsg@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movl	%ebx, %edi
	callq	_emu_check_save_file
	testq	%rax, %rax
	leaq	L_.str.10(%rip), %rax
	leaq	L_.str.9(%rip), %rcx
	cmoveq	%rax, %rcx
	leaq	L_.str.8(%rip), %rsi
	movl	%r14d, %edi
	movl	%ebx, %edx
	callq	_sprintf
	xorl	%eax, %eax
	callq	_GetTickCount
	movq	_noticeMsgTime@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
LBB0_41:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PsndOut,8,3                    ## @PsndOut
	.comm	_giz_screen,8,3                 ## @giz_screen
	.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? (PLAY=yes, STOP=no)"

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

	.comm	_PBTN_PLAY,4,2                  ## @PBTN_PLAY
	.comm	_PBTN_STOP,4,2                  ## @PBTN_STOP
L_.str.3:                               ## @.str.3
	.asciz	"LOADING GAME"

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

	.comm	_emu_stateCb,8,3                ## @emu_stateCb
	.comm	_PicoStateProgressCB,8,3        ## @PicoStateProgressCB
	.comm	_reset_timing,4,2               ## @reset_timing
	.comm	_PicoOpt,4,2                    ## @PicoOpt
	.comm	_noticeMsg,4,2                  ## @noticeMsg
L_.str.5:                               ## @.str.5
	.asciz	" 8bit fast renderer"

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

L_.str.7:                               ## @.str.7
	.asciz	" 8bit accurate renderer"

	.comm	_noticeMsgTime,4,2              ## @noticeMsgTime
L_.str.8:                               ## @.str.8
	.asciz	"SAVE SLOT %i [%s]"

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

L_.str.10:                              ## @.str.10
	.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:
	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
	mov	x19, x0
Lloh0:
	adrp	x20, _state_slot@GOTPAGE
Lloh1:
	ldr	x20, [x20, _state_slot@GOTPAGEOFF]
	tst	w0, #0x1800
	b.eq	LBB0_25
; %bb.1:
Lloh2:
	adrp	x21, _PsndOut@GOTPAGE
Lloh3:
	ldr	x21, [x21, _PsndOut@GOTPAGEOFF]
	ldr	x8, [x21]
	cbz	x8, LBB0_3
; %bb.2:
	mov	w0, #1
	bl	_FrameworkAudio_SetPause
LBB0_3:
Lloh4:
	adrp	x22, _giz_screen@GOTPAGE
Lloh5:
	ldr	x22, [x22, _giz_screen@GOTPAGEOFF]
	ldr	x8, [x22]
	cbnz	x8, LBB0_5
; %bb.4:
	mov	w0, #1
	bl	_fb_lock
	str	x0, [x22]
LBB0_5:
	ldr	w0, [x20]
	bl	_emu_check_save_file
	and	w22, w19, #0x1000
	cbz	x0, LBB0_18
; %bb.6:
Lloh6:
	adrp	x8, _currentConfig@GOTPAGE
Lloh7:
	ldr	x8, [x8, _currentConfig@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cbnz	w22, LBB0_9
; %bb.7:
	tbz	w8, #9, LBB0_19
; %bb.8:
Lloh9:
	adrp	x1, l_.str.2@PAGE
Lloh10:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_11
LBB0_9:
	tbz	w8, #11, LBB0_20
; %bb.10:
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_11:
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	bl	_blit
	bl	_Framework_PollGetButtons
Lloh15:
	adrp	x23, _PBTN_PLAY@GOTPAGE
Lloh16:
	ldr	x23, [x23, _PBTN_PLAY@GOTPAGEOFF]
	ldr	w9, [x23]
Lloh17:
	adrp	x24, _PBTN_STOP@GOTPAGE
Lloh18:
	ldr	x24, [x24, _PBTN_STOP@GOTPAGEOFF]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x24]
	orr	w9, w8, w9
	tst	w9, w0
	b.ne	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	w0, #50
	bl	_Sleep
	bl	_Framework_PollGetButtons
	ldr	w9, [x23]
	b	LBB0_12
LBB0_14:
	and	w25, w8, w0
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	bl	_Framework_PollGetButtons
	ldr	w8, [x23]
	ldr	w9, [x24]
	orr	w8, w9, w8
	tst	w8, w0
	b.eq	LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	w0, #50
	bl	_Sleep
	b	LBB0_15
LBB0_17:
	mov	w0, #0
	bl	_clearArea
	cbnz	w25, LBB0_22
LBB0_18:
	cbnz	w22, LBB0_20
LBB0_19:
	mov	w22, #0
Lloh19:
	adrp	x2, l_.str.4@PAGE
Lloh20:
	add	x2, x2, l_.str.4@PAGEOFF
	b	LBB0_21
LBB0_20:
Lloh21:
	adrp	x2, l_.str.3@PAGE
Lloh22:
	add	x2, x2, l_.str.3@PAGEOFF
LBB0_21:
	mov	w0, #4
	mov	w1, #232
	bl	_osd_text
Lloh23:
	adrp	x8, _emu_stateCb@GOTPAGE
Lloh24:
	ldr	x8, [x8, _emu_stateCb@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
Lloh26:
	adrp	x23, _PicoStateProgressCB@GOTPAGE
Lloh27:
	ldr	x23, [x23, _PicoStateProgressCB@GOTPAGEOFF]
	str	x8, [x23]
	lsr	w0, w22, #12
	mov	w1, #0
	bl	_emu_save_load_game
	str	xzr, [x23]
	mov	w0, #0
	bl	_Sleep
LBB0_22:
	ldr	x8, [x21]
	cbz	x8, LBB0_24
; %bb.23:
	mov	w0, #0
	bl	_FrameworkAudio_SetPause
LBB0_24:
Lloh28:
	adrp	x8, _reset_timing@GOTPAGE
Lloh29:
	ldr	x8, [x8, _reset_timing@GOTPAGEOFF]
	mov	w9, #1
Lloh30:
	str	w9, [x8]
LBB0_25:
Lloh31:
	adrp	x21, _noticeMsgTime@GOTPAGE
Lloh32:
	ldr	x21, [x21, _noticeMsgTime@GOTPAGEOFF]
	tbz	w19, #10, LBB0_35
; %bb.26:
Lloh33:
	adrp	x22, _PicoOpt@GOTPAGE
Lloh34:
	ldr	x22, [x22, _PicoOpt@GOTPAGEOFF]
	ldr	w8, [x22]
	tbnz	w8, #4, LBB0_28
; %bb.27:
	orr	w8, w8, #0x10
	str	w8, [x22]
Lloh35:
	adrp	x8, _currentConfig@GOTPAGE
Lloh36:
	ldr	x8, [x8, _currentConfig@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	and	w8, w8, #0xffffff7f
	b	LBB0_29
LBB0_28:
	and	w8, w8, #0xffffffef
	str	w8, [x22]
Lloh38:
	adrp	x8, _currentConfig@GOTPAGE
Lloh39:
	ldr	x8, [x8, _currentConfig@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	orr	w8, w8, #0x80
LBB0_29:
Lloh41:
	adrp	x23, _currentConfig@GOTPAGE
Lloh42:
	ldr	x23, [x23, _currentConfig@GOTPAGEOFF]
	str	w8, [x23]
	bl	_vidResetMode
	ldrb	w8, [x22]
	tbnz	w8, #4, LBB0_32
; %bb.30:
Lloh43:
	adrp	x8, _noticeMsg@GOTPAGE
Lloh44:
	ldr	x8, [x8, _noticeMsg@GOTPAGEOFF]
Lloh45:
	ldr	w0, [x8]
	ldrb	w8, [x23]
	tbnz	w8, #7, LBB0_33
; %bb.31:
Lloh46:
	adrp	x1, l_.str.7@PAGE
Lloh47:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_34
LBB0_32:
Lloh48:
	adrp	x8, _noticeMsg@GOTPAGE
Lloh49:
	ldr	x8, [x8, _noticeMsg@GOTPAGEOFF]
Lloh50:
	ldr	w0, [x8]
Lloh51:
	adrp	x1, l_.str.5@PAGE
Lloh52:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_34
LBB0_33:
Lloh53:
	adrp	x1, l_.str.6@PAGE
Lloh54:
	add	x1, x1, l_.str.6@PAGEOFF
LBB0_34:
	bl	_strcpy
	bl	_GetTickCount
	str	w0, [x21]
LBB0_35:
	tst	w19, #0x300
	b.eq	LBB0_37
; %bb.36:
	ldr	w8, [x20]
	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, [x20]
Lloh55:
	adrp	x8, _noticeMsg@GOTPAGE
Lloh56:
	ldr	x8, [x8, _noticeMsg@GOTPAGEOFF]
Lloh57:
	ldr	w20, [x8]
	mov	x0, x19
	bl	_emu_check_save_file
Lloh58:
	adrp	x8, l_.str.9@PAGE
Lloh59:
	add	x8, x8, l_.str.9@PAGEOFF
Lloh60:
	adrp	x9, l_.str.10@PAGE
Lloh61:
	add	x9, x9, l_.str.10@PAGEOFF
	cmp	x0, #0
	csel	x3, x9, x8, eq
Lloh62:
	adrp	x1, l_.str.8@PAGE
Lloh63:
	add	x1, x1, l_.str.8@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_sprintf
	bl	_GetTickCount
	str	w0, [x21]
LBB0_37:
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotStr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpAdd	Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpAdd	Lloh53, Lloh54
	.loh AdrpAdd	Lloh62, Lloh63
	.loh AdrpAdd	Lloh60, Lloh61
	.loh AdrpAdd	Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.cfi_endproc
                                        ; -- End function
	.comm	_PsndOut,8,3                    ; @PsndOut
	.comm	_giz_screen,8,3                 ; @giz_screen
	.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? (PLAY=yes, STOP=no)"

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

	.comm	_PBTN_PLAY,4,2                  ; @PBTN_PLAY
	.comm	_PBTN_STOP,4,2                  ; @PBTN_STOP
l_.str.3:                               ; @.str.3
	.asciz	"LOADING GAME"

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

	.comm	_emu_stateCb,8,3                ; @emu_stateCb
	.comm	_PicoStateProgressCB,8,3        ; @PicoStateProgressCB
	.comm	_reset_timing,4,2               ; @reset_timing
	.comm	_PicoOpt,4,2                    ; @PicoOpt
	.comm	_noticeMsg,4,2                  ; @noticeMsg
l_.str.5:                               ; @.str.5
	.asciz	" 8bit fast renderer"

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

l_.str.7:                               ; @.str.7
	.asciz	" 8bit accurate renderer"

	.comm	_noticeMsgTime,4,2              ; @noticeMsgTime
l_.str.8:                               ; @.str.8
	.asciz	"SAVE SLOT %i [%s]"

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

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

	.no_dead_strip	_RunEvents
.subsections_via_symbols
