	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function LoadROM
_LoadROM:                               ## @LoadROM
	.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
	subq	$48, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	_MAX_PATH@GOTPCREL(%rip), %r12
	movl	(%r12), %ebx
	movq	%rbx, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r14
	testq	%r15, %r15
	je	LBB0_4
## %bb.1:
	movq	%r15, %rdi
	callq	_strlen
	testl	%eax, %eax
	je	LBB0_4
## %bb.2:
	xorl	%esi, %esi
	cmpb	$34, (%r15)
	sete	%sil
	addq	%r15, %rsi
	movq	%r14, %rdi
	callq	_strcpy
	movq	%r14, %rdi
	callq	_strlen
	cltq
	cmpb	$34, -1(%rax,%r14)
	jne	LBB0_5
## %bb.3:
	movq	%r14, %rdi
	callq	_strlen
	cltq
	movb	$0, -1(%rax,%r14)
	jmp	LBB0_5
LBB0_4:
	leaq	-80(%rbp), %r15
	movq	%r15, %rdi
	movl	$40, %esi
	callq	_ZeroMemory
	movb	$0, -1(%r14,%rbx)
	decq	%rbx
	movq	_rom_fname_loaded@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_strncpy
	movl	$40, -80(%rbp)
	leaq	l_.str(%rip), %rax
	movq	%rax, -72(%rbp)
	movq	%r14, -64(%rbp)
	movl	(%r12), %eax
	movl	%eax, -56(%rbp)
	movq	_OFN_FILEMUSTEXIST@GOTPCREL(%rip), %rax
	movq	_OFN_HIDEREADONLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	%ecx, -52(%rbp)
	movq	_FrameWnd@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	movq	%r15, %rdi
	callq	_GetOpenFileName
	testl	%eax, %eax
	je	LBB0_10
LBB0_5:
	movq	_engineState@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movq	_PGS_Running@GOTPCREL(%rip), %r15
	cmpq	(%r15), %rax
	jne	LBB0_7
## %bb.6:
	movq	_PGS_Paused@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movq	_loop_end_event@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$5000, %esi                     ## imm = 0x1388
	callq	_WaitForSingleObject
LBB0_7:
	movq	%r14, %rdi
	callq	_emu_reload_rom
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	xorl	%eax, %eax
	callq	_PrepareForROM
	movq	(%r15), %rax
	movq	%rax, (%rbx)
	movq	_loop_enter_event@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_SetEvent
	jmp	LBB0_10
LBB0_8:
	movq	_menu_error_msg@GOTPCREL(%rip), %rdi
	callq	_error
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_12
## %bb.11:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_PATH,4,2                   ## @MAX_PATH
	.comm	_rom_fname_loaded,4,2           ## @rom_fname_loaded
	.section	__TEXT,__const
l_.str:                                 ## @.str
	.asciz	"ROMs, CD images\000*.smd;*.bin;*.gen;*.zip;*.32x;*.sms;*.iso;*.cso;*.cue\000whatever\000*.*\000"

	.comm	_OFN_FILEMUSTEXIST,4,2          ## @OFN_FILEMUSTEXIST
	.comm	_OFN_HIDEREADONLY,4,2           ## @OFN_HIDEREADONLY
	.comm	_FrameWnd,4,2                   ## @FrameWnd
	.comm	_engineState,8,3                ## @engineState
	.comm	_PGS_Running,8,3                ## @PGS_Running
	.comm	_PGS_Paused,8,3                 ## @PGS_Paused
	.comm	_loop_end_event,4,2             ## @loop_end_event
	.comm	_loop_enter_event,4,2           ## @loop_enter_event
	.no_dead_strip	_LoadROM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function LoadROM
_LoadROM:                               ; @LoadROM
	.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
	sub	sp, sp, #48
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
Lloh3:
	adrp	x22, _MAX_PATH@GOTPAGE
Lloh4:
	ldr	x22, [x22, _MAX_PATH@GOTPAGEOFF]
	ldr	w20, [x22]
	mov	x9, x20
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x20, #15
	and	x9, x9, #0x1fffffff0
	sub	x19, x8, x9
	mov	sp, x19
	cbz	x0, LBB0_4
; %bb.1:
	mov	x0, x21
	bl	_strlen
	cbz	w0, LBB0_4
; %bb.2:
	mov	x8, x21
	ldrb	w9, [x8], #1
	cmp	w9, #34
	csel	x1, x21, x8, ne
	mov	x0, x19
	bl	_strcpy
	mov	x0, x19
	bl	_strlen
	add	x8, x19, w0, sxtw
	ldurb	w8, [x8, #-1]
	cmp	w8, #34
	b.ne	LBB0_5
; %bb.3:
	mov	x0, x19
	bl	_strlen
	add	x8, x19, w0, sxtw
	sturb	wzr, [x8, #-1]
	b	LBB0_5
LBB0_4:
	mov	w21, #40
	sub	x0, x29, #80
	mov	w1, #40
	bl	_ZeroMemory
	sub	x2, x20, #1
	strb	wzr, [x19, x2]
Lloh7:
	adrp	x8, _rom_fname_loaded@GOTPAGE
Lloh8:
	ldr	x8, [x8, _rom_fname_loaded@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x19
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_strncpy
	stur	w21, [x29, #-80]
Lloh10:
	adrp	x8, _OFN_FILEMUSTEXIST@GOTPAGE
Lloh11:
	ldr	x8, [x8, _OFN_FILEMUSTEXIST@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _OFN_HIDEREADONLY@GOTPAGE
Lloh14:
	ldr	x9, [x9, _OFN_HIDEREADONLY@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh16:
	adrp	x9, l_.str@PAGE
Lloh17:
	add	x9, x9, l_.str@PAGEOFF
	stp	x9, x19, [x29, #-72]
	ldr	w9, [x22]
	stp	w9, w8, [x29, #-56]
Lloh18:
	adrp	x8, _FrameWnd@GOTPAGE
Lloh19:
	ldr	x8, [x8, _FrameWnd@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	stur	w8, [x29, #-48]
	sub	x0, x29, #80
	bl	_GetOpenFileName
	cbz	w0, LBB0_10
LBB0_5:
Lloh21:
	adrp	x20, _engineState@GOTPAGE
Lloh22:
	ldr	x20, [x20, _engineState@GOTPAGEOFF]
	ldr	x8, [x20]
Lloh23:
	adrp	x21, _PGS_Running@GOTPAGE
Lloh24:
	ldr	x21, [x21, _PGS_Running@GOTPAGEOFF]
	ldr	x9, [x21]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
Lloh25:
	adrp	x8, _PGS_Paused@GOTPAGE
Lloh26:
	ldr	x8, [x8, _PGS_Paused@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	str	x8, [x20]
Lloh28:
	adrp	x8, _loop_end_event@GOTPAGE
Lloh29:
	ldr	x8, [x8, _loop_end_event@GOTPAGEOFF]
Lloh30:
	ldr	w0, [x8]
	mov	w1, #5000
	bl	_WaitForSingleObject
LBB0_7:
	mov	x0, x19
	bl	_emu_reload_rom
	cbz	w0, LBB0_9
; %bb.8:
	bl	_PrepareForROM
	ldr	x8, [x21]
	str	x8, [x20]
Lloh31:
	adrp	x8, _loop_enter_event@GOTPAGE
Lloh32:
	ldr	x8, [x8, _loop_enter_event@GOTPAGEOFF]
Lloh33:
	ldr	w0, [x8]
	bl	_SetEvent
	b	LBB0_10
LBB0_9:
Lloh34:
	adrp	x0, _menu_error_msg@GOTPAGE
Lloh35:
	ldr	x0, [x0, _menu_error_msg@GOTPAGEOFF]
	bl	_error
LBB0_10:
	ldur	x8, [x29, #-40]
Lloh36:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh37:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh38:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_12
; %bb.11:
	sub	sp, x29, #32
	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_12:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_PATH,4,2                   ; @MAX_PATH
	.comm	_rom_fname_loaded,4,2           ; @rom_fname_loaded
	.section	__TEXT,__const
l_.str:                                 ; @.str
	.asciz	"ROMs, CD images\000*.smd;*.bin;*.gen;*.zip;*.32x;*.sms;*.iso;*.cso;*.cue\000whatever\000*.*\000"

	.comm	_OFN_FILEMUSTEXIST,4,2          ; @OFN_FILEMUSTEXIST
	.comm	_OFN_HIDEREADONLY,4,2           ; @OFN_HIDEREADONLY
	.comm	_FrameWnd,4,2                   ; @FrameWnd
	.comm	_engineState,8,3                ; @engineState
	.comm	_PGS_Running,8,3                ; @PGS_Running
	.comm	_PGS_Paused,8,3                 ; @PGS_Paused
	.comm	_loop_end_event,4,2             ; @loop_end_event
	.comm	_loop_enter_event,4,2           ; @loop_enter_event
	.no_dead_strip	_LoadROM
.subsections_via_symbols
