	.file	"extr_emu.c_run_events_ui.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"LOAD STATE? "
.LC1:
	.string	"OVERWRITE SAVE? "
.LC2:
	.string	"LOADING STATE"
.LC3:
	.string	"SAVING STATE"
.LC4:
	.string	"USED"
.LC5:
	.string	"FREE"
.LC6:
	.string	"(%s=yes, "
.LC7:
	.string	"%s=no)"
.LC8:
	.string	"SAVE SLOT %i [%s]"
	.text
	.p2align 4
	.type	run_events_ui, @function
run_events_ui:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	ebx, edi
	sub	rsp, 88
	.cfi_def_cfa_offset 128
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 72[rsp], rax
	xor	eax, eax
	mov	eax, DWORD PTR PEV_STATE_LOAD[rip]
	or	eax, DWORD PTR PEV_STATE_SAVE[rip]
	test	eax, edi
	jne	.L53
.L3:
	test	DWORD PTR PEV_SWITCH_RND[rip], ebx
	jne	.L54
.L16:
	mov	eax, DWORD PTR PEV_SSLOT_PREV[rip]
	mov	edx, DWORD PTR PEV_SSLOT_NEXT[rip]
	or	edx, eax
	test	edx, ebx
	je	.L17
	mov	edi, DWORD PTR state_slot[rip]
	test	eax, ebx
	je	.L18
	sub	edi, 1
	js	.L19
.L51:
	mov	DWORD PTR state_slot[rip], edi
.L20:
	xor	esi, esi
	call	emu_check_save_file@PLT
	lea	rdx, .LC4[rip]
	mov	esi, DWORD PTR state_slot[rip]
	lea	rdi, .LC8[rip]
	test	rax, rax
	lea	rax, .LC5[rip]
	cmove	rdx, rax
	call	emu_status_msg@PLT
.L17:
	test	DWORD PTR PEV_MENU[rip], ebx
	je	.L1
	mov	eax, DWORD PTR PGS_Menu[rip]
	mov	DWORD PTR engineState[rip], eax
.L1:
	mov	rax, QWORD PTR 72[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L55
	add	rsp, 88
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	add	edi, 1
	cmp	edi, 9
	jle	.L51
	mov	DWORD PTR state_slot[rip], 0
	xor	edi, edi
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L54:
	xor	esi, esi
	mov	edi, 1
	call	plat_video_toggle_renderer@PLT
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L53:
	mov	edi, DWORD PTR state_slot[rip]
	xor	esi, esi
	call	emu_check_save_file@PLT
	test	rax, rax
	je	.L50
	test	DWORD PTR PEV_STATE_LOAD[rip], ebx
	je	.L6
	mov	eax, DWORD PTR currentConfig[rip]
	test	DWORD PTR EOPT_CONFIRM_LOAD[rip], eax
	jne	.L28
	test	DWORD PTR PEV_STATE_SAVE[rip], ebx
	je	.L14
	test	DWORD PTR EOPT_CONFIRM_SAVE[rip], eax
	je	.L14
	.p2align 4,,10
	.p2align 3
.L28:
	lea	rsi, .LC0[rip]
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	test	DWORD PTR PEV_STATE_SAVE[rip], ebx
	je	.L9
	mov	eax, DWORD PTR EOPT_CONFIRM_SAVE[rip]
	lea	rsi, .LC1[rip]
	test	DWORD PTR currentConfig[rip], eax
	je	.L9
.L7:
	mov	r12, rsp
	mov	r13d, 64
	mov	rdi, r12
	call	strcpy@PLT
	mov	rdi, r12
	call	strlen@PLT
	mov	esi, DWORD PTR PBTN_MOK[rip]
	mov	edi, -1
	mov	ebp, eax
	neg	esi
	call	in_get_key_name@PLT
	movsx	rdi, ebp
	mov	esi, r13d
	lea	rdx, .LC6[rip]
	mov	rcx, rax
	sub	esi, ebp
	add	rdi, r12
	call	snprintf@PLT
	mov	rdi, r12
	call	strlen@PLT
	mov	esi, DWORD PTR PBTN_MBACK[rip]
	mov	edi, -1
	mov	ebp, eax
	neg	esi
	call	in_get_key_name@PLT
	mov	esi, r13d
	movsx	rdi, ebp
	lea	rdx, .LC7[rip]
	sub	esi, ebp
	mov	rcx, rax
	add	rdi, r12
	call	snprintf@PLT
	mov	rdi, r12
	call	plat_status_msg_busy_first@PLT
	mov	esi, DWORD PTR IN_CFG_BLOCKING[rip]
	mov	edx, 1
	xor	edi, edi
	call	in_set_config_int@PLT
	.p2align 4,,10
	.p2align 3
.L10:
	mov	esi, 50
	xor	edi, edi
	call	in_menu_wait_any@PLT
	mov	r8d, eax
	mov	eax, DWORD PTR PBTN_MOK[rip]
	or	eax, DWORD PTR PBTN_MBACK[rip]
	test	eax, r8d
	jne	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	mov	esi, 50
	xor	edi, edi
	call	in_menu_wait_any@PLT
	mov	edx, DWORD PTR PBTN_MBACK[rip]
	mov	ecx, DWORD PTR PBTN_MOK[rip]
	or	ecx, edx
	test	ecx, eax
	je	.L11
	and	edx, eax
	mov	ebp, edx
	.p2align 4,,10
	.p2align 3
.L12:
	mov	esi, 50
	xor	edi, edi
	call	in_menu_wait_any@PLT
	mov	r8d, eax
	mov	eax, DWORD PTR PBTN_MOK[rip]
	or	eax, DWORD PTR PBTN_MBACK[rip]
	test	eax, r8d
	jne	.L12
	mov	esi, DWORD PTR IN_CFG_BLOCKING[rip]
	xor	edx, edx
	xor	edi, edi
	call	in_set_config_int@PLT
	test	ebp, ebp
	jne	.L3
	.p2align 4,,10
	.p2align 3
.L50:
	mov	eax, DWORD PTR PEV_STATE_LOAD[rip]
	and	eax, ebx
	test	eax, eax
	je	.L9
.L14:
	lea	rdi, .LC2[rip]
.L15:
	call	plat_status_msg_busy_first@PLT
	mov	rax, QWORD PTR plat_status_msg_busy_next[rip]
	xor	edi, edi
	test	DWORD PTR PEV_STATE_LOAD[rip], ebx
	setne	dil
	xor	esi, esi
	mov	QWORD PTR PicoStateProgressCB[rip], rax
	call	emu_save_load_game@PLT
	mov	QWORD PTR PicoStateProgressCB[rip], 0
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L19:
	mov	DWORD PTR state_slot[rip], 9
	mov	edi, 9
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L9:
	lea	rdi, .LC3[rip]
	jmp	.L15
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	run_events_ui, .-run_events_ui
	.comm	state_slot,4,4
	.comm	plat_status_msg_busy_next,8,8
	.comm	engineState,4,4
	.comm	currentConfig,4,4
	.comm	PicoStateProgressCB,8,8
	.comm	PGS_Menu,4,4
	.comm	PEV_SWITCH_RND,4,4
	.comm	PEV_STATE_SAVE,4,4
	.comm	PEV_STATE_LOAD,4,4
	.comm	PEV_SSLOT_PREV,4,4
	.comm	PEV_SSLOT_NEXT,4,4
	.comm	PEV_MENU,4,4
	.comm	PBTN_MOK,4,4
	.comm	PBTN_MBACK,4,4
	.comm	IN_CFG_BLOCKING,4,4
	.comm	EOPT_CONFIRM_SAVE,4,4
	.comm	EOPT_CONFIRM_LOAD,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_emu.c_run_events_ui.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"LOAD STATE? \000"
	.align	2
.LC1:
	.ascii	"OVERWRITE SAVE? \000"
	.align	2
.LC2:
	.ascii	"LOADING STATE\000"
	.align	2
.LC3:
	.ascii	"SAVING STATE\000"
	.align	2
.LC4:
	.ascii	"USED\000"
	.align	2
.LC5:
	.ascii	"FREE\000"
	.align	2
.LC6:
	.ascii	"(%s=yes, \000"
	.align	2
.LC7:
	.ascii	"%s=no)\000"
	.align	2
.LC8:
	.ascii	"SAVE SLOT %i [%s]\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC9:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	run_events_ui, %function
run_events_ui:
	@ args = 0, pretend = 0, frame = 72
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	ldr	r5, .L56
	ldr	r6, .L56+4
	ldr	r3, [r5]
	ldr	r2, [r6]
	ldr	r1, .L56+8
	orr	r3, r3, r2
	sub	sp, sp, #76
	tst	r3, r0
	mov	r4, r0
	ldr	r1, [r1]
	str	r1, [sp, #68]
	mov	r1,#0
	bne	.L53
.L3:
	ldr	r3, .L56+12
	ldr	r3, [r3]
	tst	r4, r3
	bne	.L54
.L16:
	ldr	r2, .L56+16
	ldr	r3, .L56+20
	ldr	r2, [r2]
	ldr	r3, [r3]
	orr	r3, r2, r3
	tst	r3, r4
	beq	.L17
	ldr	r3, .L56+24
	ands	r2, r2, r4
	ldr	r5, [r3]
	beq	.L18
	subs	r5, r5, #1
	movmi	r5, #9
.L51:
	str	r5, [r3]
.L20:
	mov	r1, #0
	mov	r0, r5
	bl	emu_check_save_file
	ldr	r3, .L56+28
	cmp	r0, #0
	ldr	r2, .L56+32
	mov	r1, r5
	moveq	r2, r3
	ldr	r0, .L56+36
	bl	emu_status_msg
.L17:
	ldr	r3, .L56+40
	ldr	r3, [r3]
	tst	r4, r3
	ldrne	r2, .L56+44
	ldrne	r3, .L56+48
	ldrne	r2, [r2]
	strne	r2, [r3]
.L1:
	ldr	r3, .L56+8
	ldr	r2, [r3]
	ldr	r3, [sp, #68]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L55
	add	sp, sp, #76
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L18:
	add	r5, r5, #1
	cmp	r5, #9
	movgt	r5, r2
	strgt	r2, [r3]
	bgt	.L20
	b	.L51
.L54:
	mov	r1, #0
	mov	r0, #1
	bl	plat_video_toggle_renderer
	b	.L16
.L53:
	ldr	r3, .L56+24
	mov	r1, #0
	ldr	r0, [r3]
	bl	emu_check_save_file
	cmp	r0, #0
	ldr	r3, [r5]
	beq	.L50
	tst	r4, r3
	beq	.L6
	ldr	r3, .L56+52
	ldr	r2, .L56+56
	ldr	r3, [r3]
	ldr	r2, [r2]
	tst	r3, r2
	bne	.L28
	ldr	r2, [r6]
	tst	r4, r2
	beq	.L14
	ldr	r2, .L56+60
	ldr	r2, [r2]
	tst	r3, r2
	beq	.L14
.L28:
	ldr	r1, .L56+64
	b	.L7
.L6:
	ldr	r3, [r6]
	tst	r4, r3
	beq	.L9
	ldr	r2, .L56+60
	ldr	r3, .L56+52
	ldr	r2, [r2]
	ldr	r3, [r3]
	tst	r2, r3
	beq	.L9
	ldr	r1, .L56+68
.L7:
	add	r0, sp, #4
	bl	strcpy
	add	r0, sp, #4
	bl	strlen
	ldr	r7, .L56+72
	mov	r8, r0
	ldr	r1, [r7]
	mvn	r0, #0
	rsb	r1, r1, #0
	bl	in_get_key_name
	add	r2, sp, #4
	mov	r3, r0
	rsb	r1, r8, #64
	add	r0, r2, r8
	ldr	r2, .L56+76
	bl	snprintf
	add	r0, sp, #4
	bl	strlen
	ldr	r6, .L56+80
	mov	r8, r0
	ldr	r1, [r6]
	mvn	r0, #0
	rsb	r1, r1, #0
	bl	in_get_key_name
	add	r2, sp, #4
	mov	r3, r0
	rsb	r1, r8, #64
	add	r0, r2, r8
	ldr	r9, .L56+84
	ldr	r2, .L56+88
	bl	snprintf
	add	r0, sp, #4
	bl	plat_status_msg_busy_first
	mov	r2, #1
	mov	r0, #0
	ldr	r1, [r9]
	bl	in_set_config_int
.L10:
	mov	r1, #50
	mov	r0, #0
	bl	in_menu_wait_any
	ldr	r3, [r7]
	ldr	r2, [r6]
	orr	r3, r3, r2
	tst	r3, r0
	bne	.L10
.L11:
	mov	r1, #50
	mov	r0, #0
	bl	in_menu_wait_any
	ldr	r8, [r6]
	ldr	r3, [r7]
	orr	r3, r8, r3
	tst	r3, r0
	beq	.L11
	and	r8, r8, r0
.L12:
	mov	r1, #50
	mov	r0, #0
	bl	in_menu_wait_any
	ldr	r2, [r7]
	ldr	r3, [r6]
	orr	r2, r2, r3
	ands	r2, r2, r0
	bne	.L12
	mov	r0, r2
	ldr	r1, [r9]
	bl	in_set_config_int
	cmp	r8, #0
	bne	.L3
	ldr	r3, [r5]
.L50:
	and	r3, r3, r4
	cmp	r3, #0
	beq	.L9
.L14:
	ldr	r0, .L56+92
.L15:
	bl	plat_status_msg_busy_first
	ldr	r2, [r5]
	ldr	r3, .L56+96
	tst	r4, r2
	ldr	r3, [r3]
	ldr	r5, .L56+100
	movne	r0, #1
	moveq	r0, #0
	mov	r1, #0
	str	r3, [r5]
	bl	emu_save_load_game
	mov	r3, #0
	str	r3, [r5]
	b	.L3
.L9:
	ldr	r0, .L56+104
	b	.L15
.L55:
	bl	__stack_chk_fail
.L57:
	.align	2
.L56:
	.word	PEV_STATE_LOAD
	.word	PEV_STATE_SAVE
	.word	.LC9
	.word	PEV_SWITCH_RND
	.word	PEV_SSLOT_PREV
	.word	PEV_SSLOT_NEXT
	.word	state_slot
	.word	.LC5
	.word	.LC4
	.word	.LC8
	.word	PEV_MENU
	.word	PGS_Menu
	.word	engineState
	.word	currentConfig
	.word	EOPT_CONFIRM_LOAD
	.word	EOPT_CONFIRM_SAVE
	.word	.LC0
	.word	.LC1
	.word	PBTN_MOK
	.word	.LC6
	.word	PBTN_MBACK
	.word	IN_CFG_BLOCKING
	.word	.LC7
	.word	.LC2
	.word	plat_status_msg_busy_next
	.word	PicoStateProgressCB
	.word	.LC3
	.size	run_events_ui, .-run_events_ui
	.comm	state_slot,4,4
	.comm	plat_status_msg_busy_next,4,4
	.comm	engineState,4,4
	.comm	currentConfig,4,4
	.comm	PicoStateProgressCB,4,4
	.comm	PGS_Menu,4,4
	.comm	PEV_SWITCH_RND,4,4
	.comm	PEV_STATE_SAVE,4,4
	.comm	PEV_STATE_LOAD,4,4
	.comm	PEV_SSLOT_PREV,4,4
	.comm	PEV_SSLOT_NEXT,4,4
	.comm	PEV_MENU,4,4
	.comm	PBTN_MOK,4,4
	.comm	PBTN_MBACK,4,4
	.comm	IN_CFG_BLOCKING,4,4
	.comm	EOPT_CONFIRM_SAVE,4,4
	.comm	EOPT_CONFIRM_LOAD,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
