	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mh_saveloadcfg
_mh_saveloadcfg:                        ## @mh_saveloadcfg
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
                                        ## kill: def $edi killed $edi def $rdi
	movq	_PBTN_LEFT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_PBTN_RIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%ecx, %eax
	testl	%esi, %eax
	je	LBB0_6
## %bb.1:
	andl	%esi, %ecx
	xorl	%eax, %eax
	negl	%ecx
	movl	$0, %ecx
	sbbl	%ecx, %ecx
	orl	$1, %ecx
	movq	_config_slot@GOTPCREL(%rip), %rdx
	addl	(%rdx), %ecx
	movl	%ecx, (%rdx)
	js	LBB0_2
## %bb.3:
	cmpl	$10, %ecx
	jae	LBB0_4
	jmp	LBB0_5
LBB0_6:
	leal	-128(%rdi), %eax
	cmpl	$2, %eax
	jae	LBB0_7
## %bb.11:
	xorl	%eax, %eax
	cmpl	$128, %edi
	sete	%al
	movl	%eax, %edi
	callq	_emu_write_config
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_15
LBB0_2:
	movl	$9, %eax
LBB0_4:
	movl	%eax, (%rdx)
	movl	%eax, %ecx
LBB0_5:
	movq	_e_menu_options@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_config_slot_current@GOTPCREL(%rip), %rax
	xorl	%edx, %edx
	cmpl	(%rax), %ecx
	setne	%dl
	movl	$130, %esi
	callq	_me_enable
	xorl	%ebx, %ebx
	jmp	LBB0_16
LBB0_7:
	xorl	%ebx, %ebx
	cmpl	$130, %edi
	jne	LBB0_16
## %bb.8:
	movq	_rom_fname_loaded@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movl	$1, %ebx
	movl	$1, %esi
	callq	_emu_read_config
	testl	%eax, %eax
	jne	LBB0_10
## %bb.9:
	xorl	%edi, %edi
	movl	$1, %esi
	callq	_emu_read_config
	testl	%eax, %eax
	je	LBB0_14
LBB0_10:
	leaq	L_.str.2(%rip), %rdi
	callq	_menu_update_msg
	jmp	LBB0_16
LBB0_13:
	leaq	L_.str.1(%rip), %rdi
LBB0_15:
	callq	_menu_update_msg
	movl	$1, %ebx
LBB0_16:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_14:
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_PBTN_LEFT,4,2                  ## @PBTN_LEFT
	.comm	_PBTN_RIGHT,4,2                 ## @PBTN_RIGHT
	.comm	_config_slot,4,2                ## @config_slot
	.comm	_e_menu_options,4,2             ## @e_menu_options
	.comm	_config_slot_current,4,2        ## @config_slot_current
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"config saved"

L_.str.1:                               ## @.str.1
	.asciz	"failed to write config"

	.comm	_rom_fname_loaded,8,3           ## @rom_fname_loaded
L_.str.2:                               ## @.str.2
	.asciz	"config loaded"

L_.str.3:                               ## @.str.3
	.asciz	"failed to load config"

	.no_dead_strip	_mh_saveloadcfg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mh_saveloadcfg
_mh_saveloadcfg:                        ; @mh_saveloadcfg
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
Lloh0:
	adrp	x8, _PBTN_LEFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PBTN_LEFT@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x8]
Lloh3:
	adrp	x8, _PBTN_RIGHT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PBTN_RIGHT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	orr	w8, w8, w9
	tst	w8, w1
	b.eq	LBB0_4
; %bb.1:
Lloh6:
	adrp	x8, _config_slot@GOTPAGE
Lloh7:
	ldr	x8, [x8, _config_slot@GOTPAGEOFF]
	ldr	w10, [x8]
	sub	w11, w10, #1
	tst	w9, w1
	csinc	w9, w11, w10, ne
	str	w9, [x8]
	tbnz	w9, #31, LBB0_7
; %bb.2:
	cmp	w9, #10
	b.lo	LBB0_9
; %bb.3:
	mov	w9, #0
	b	LBB0_8
LBB0_4:
	sub	w8, w0, #128
	cmp	w8, #2
	b.hs	LBB0_11
; %bb.5:
	cmp	w0, #128
	cset	w0, eq
	bl	_emu_write_config
	cbz	w0, LBB0_15
; %bb.6:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_16
LBB0_7:
	mov	w9, #9
LBB0_8:
	str	w9, [x8]
LBB0_9:
Lloh10:
	adrp	x8, _e_menu_options@GOTPAGE
Lloh11:
	ldr	x8, [x8, _e_menu_options@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
Lloh13:
	adrp	x8, _config_slot_current@GOTPAGE
Lloh14:
	ldr	x8, [x8, _config_slot_current@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	w9, w8
	cset	w2, ne
	mov	w1, #130
	bl	_me_enable
LBB0_10:
	mov	w0, #0
	ldp	x29, x30, [sp], #16             ; 16-byte Folded Reload
	ret
LBB0_11:
	cmp	w0, #130
	b.ne	LBB0_10
; %bb.12:
Lloh16:
	adrp	x8, _rom_fname_loaded@GOTPAGE
Lloh17:
	ldr	x8, [x8, _rom_fname_loaded@GOTPAGEOFF]
Lloh18:
	ldr	x0, [x8]
	mov	w1, #1
	bl	_emu_read_config
	cbnz	w0, LBB0_14
; %bb.13:
	mov	x0, #0
	mov	w1, #1
	bl	_emu_read_config
	cbz	w0, LBB0_17
LBB0_14:
Lloh19:
	adrp	x0, l_.str.2@PAGE
Lloh20:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_16
LBB0_15:
Lloh21:
	adrp	x0, l_.str.1@PAGE
Lloh22:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_16:
	bl	_menu_update_msg
	mov	w0, #1
	ldp	x29, x30, [sp], #16             ; 16-byte Folded Reload
	ret
LBB0_17:
Lloh23:
	adrp	x0, l_.str.3@PAGE
Lloh24:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_PBTN_LEFT,4,2                  ; @PBTN_LEFT
	.comm	_PBTN_RIGHT,4,2                 ; @PBTN_RIGHT
	.comm	_config_slot,4,2                ; @config_slot
	.comm	_e_menu_options,4,2             ; @e_menu_options
	.comm	_config_slot_current,4,2        ; @config_slot_current
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"config saved"

l_.str.1:                               ; @.str.1
	.asciz	"failed to write config"

	.comm	_rom_fname_loaded,8,3           ; @rom_fname_loaded
l_.str.2:                               ; @.str.2
	.asciz	"config loaded"

l_.str.3:                               ; @.str.3
	.asciz	"failed to load config"

	.no_dead_strip	_mh_saveloadcfg
.subsections_via_symbols
