	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_menu_loop_tray                 ## -- Begin function menu_loop_tray
	.p2align	4, 0x90
_menu_loop_tray:                        ## @menu_loop_tray
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAX_PATH@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %rbx
	xorl	%eax, %eax
	callq	_menu_gfx_prepare
	movq	_loadedRomFName@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%rax, %rdi
	callq	_fclose
	movl	(%r15), %esi
	movq	%rbx, %rdi
	callq	_strcpy
	jmp	LBB0_3
LBB0_2:
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_getcwd
LBB0_3:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	callq	_draw_menu_tray
	xorl	%eax, %eax
	callq	_Framework_PollGetButtons
	movq	_PBTN_PLAY@GOTPCREL(%rip), %r12
	testl	%eax, (%r12)
	je	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	$50, %edi
	callq	_Sleep
	xorl	%eax, %eax
	callq	_Framework_PollGetButtons
	testl	%eax, (%r12)
	jne	LBB0_4
LBB0_6:
	movq	_PBTN_UP@GOTPCREL(%rip), %r13
	movq	_PBTN_DOWN@GOTPCREL(%rip), %r15
	movq	_menuErrorMsg@GOTPCREL(%rip), %r14
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$1, %ebx
	je	LBB0_16
LBB0_24:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	(%r14), %rax
	movq	$0, (%rax)
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_draw_menu_tray
	movl	(%r15), %edi
	orl	(%r13), %edi
	orl	(%r12), %edi
	callq	_in_menu_wait
	movslq	(%r13), %rcx
	movl	$1, %edx
	testl	%ebx, %ebx
	jle	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	leal	-1(%rbx), %edx
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	testq	%rcx, %rax
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%edx, %ebx
LBB0_11:                                ##   in Loop: Header=BB0_7 Depth=1
	movslq	(%r15), %rcx
	xorl	%edx, %edx
	testl	%ebx, %ebx
	jg	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=1
	leal	1(%rbx), %edx
LBB0_13:                                ##   in Loop: Header=BB0_7 Depth=1
	testq	%rcx, %rax
	cmovnel	%edx, %ebx
	movslq	(%r12), %rcx
	testq	%rcx, %rax
	je	LBB0_24
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=1
	testl	%ebx, %ebx
	jne	LBB0_15
## %bb.19:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_romsel_loop
	testq	%rax, %rax
	je	LBB0_24
## %bb.20:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	_romFileName@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	xorl	%edi, %edi
	callq	_emu_cdCheck
	movq	_CIT_NOT_CD@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_23
## %bb.21:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	(%rbx), %edi
	movl	%eax, %esi
	callq	_Insert_CD
	testl	%eax, %eax
	je	LBB0_22
LBB0_23:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	(%r14), %rax
	movups	L_.str.1+15(%rip), %xmm0
	movups	%xmm0, 15(%rax)
	movups	L_.str.1(%rip), %xmm0
	movups	%xmm0, (%rax)
	movq	(%r14), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_lprintf
	xorl	%ebx, %ebx
	jmp	LBB0_7
LBB0_16:
	xorl	%eax, %eax
	jmp	LBB0_17
LBB0_22:
	movl	$1, %eax
LBB0_17:
	movq	_PGS_RestartRun@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_engineState@GOTPCREL(%rip), %rdx
	movl	%ecx, (%rdx)
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_18
## %bb.25:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_PATH,4,2                   ## @MAX_PATH
	.comm	_loadedRomFName,4,2             ## @loadedRomFName
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rb"

	.comm	_PBTN_PLAY,4,2                  ## @PBTN_PLAY
	.comm	_PBTN_UP,4,2                    ## @PBTN_UP
	.comm	_PBTN_DOWN,4,2                  ## @PBTN_DOWN
	.comm	_romFileName,4,2                ## @romFileName
	.comm	_CIT_NOT_CD,4,2                 ## @CIT_NOT_CD
	.comm	_menuErrorMsg,8,3               ## @menuErrorMsg
L_.str.1:                               ## @.str.1
	.asciz	"Load failed, invalid CD image?"

L_.str.2:                               ## @.str.2
	.asciz	"%s\n"

	.comm	_PGS_RestartRun,4,2             ## @PGS_RestartRun
	.comm	_engineState,4,2                ## @engineState
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_menu_loop_tray                 ; -- Begin function menu_loop_tray
	.p2align	2
_menu_loop_tray:                        ; @menu_loop_tray
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #16
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x20, _MAX_PATH@GOTPAGE
Lloh4:
	ldr	x20, [x20, _MAX_PATH@GOTPAGEOFF]
	ldr	w8, [x20]
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x1fffffff0
	sub	x19, x9, x8
	mov	sp, x19
	bl	_menu_gfx_prepare
Lloh7:
	adrp	x21, _loadedRomFName@GOTPAGE
Lloh8:
	ldr	x21, [x21, _loadedRomFName@GOTPAGEOFF]
	ldr	w0, [x21]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_2
; %bb.1:
	bl	_fclose
	ldr	w1, [x21]
	mov	x0, x19
	bl	_strcpy
	b	LBB0_3
LBB0_2:
	ldr	w1, [x20]
	mov	x0, x19
	bl	_getcwd
LBB0_3:
	mov	w0, #0
	bl	_draw_menu_tray
	bl	_Framework_PollGetButtons
Lloh11:
	adrp	x22, _PBTN_PLAY@GOTPAGE
Lloh12:
	ldr	x22, [x22, _PBTN_PLAY@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x22]
	tst	w8, w0
	b.eq	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w0, #50
	bl	_Sleep
	bl	_Framework_PollGetButtons
	b	LBB0_4
LBB0_6:
	mov	w21, #0
Lloh13:
	adrp	x23, _PBTN_UP@GOTPAGE
Lloh14:
	ldr	x23, [x23, _PBTN_UP@GOTPAGEOFF]
Lloh15:
	adrp	x24, _PBTN_DOWN@GOTPAGE
Lloh16:
	ldr	x24, [x24, _PBTN_DOWN@GOTPAGEOFF]
Lloh17:
	adrp	x25, _menuErrorMsg@GOTPAGE
Lloh18:
	ldr	x25, [x25, _menuErrorMsg@GOTPAGEOFF]
Lloh19:
	adrp	x26, l_.str.1@PAGE
Lloh20:
	add	x26, x26, l_.str.1@PAGEOFF
Lloh21:
	adrp	x27, _romFileName@GOTPAGE
Lloh22:
	ldr	x27, [x27, _romFileName@GOTPAGEOFF]
Lloh23:
	adrp	x28, _CIT_NOT_CD@GOTPAGE
Lloh24:
	ldr	x28, [x28, _CIT_NOT_CD@GOTPAGEOFF]
Lloh25:
	adrp	x20, l_.str.2@PAGE
Lloh26:
	add	x20, x20, l_.str.2@PAGEOFF
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	cmp	w21, #1
	b.eq	LBB0_15
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x25]
	str	xzr, [x8]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_draw_menu_tray
	ldr	w8, [x23]
	ldr	w9, [x24]
	orr	w8, w9, w8
	ldr	w9, [x22]
	orr	w0, w8, w9
	bl	_in_menu_wait
	ldrsw	x8, [x23]
	subs	w9, w21, #1
	csinc	w9, w9, wzr, ge
	tst	x0, x8
	csel	w8, w21, w9, eq
	ldrsw	x9, [x24]
	cmp	w8, #0
	csinc	w10, wzr, w8, gt
	tst	x0, x9
	csel	w21, w8, w10, eq
	ldrsw	x8, [x22]
	tst	x0, x8
	b.eq	LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	cbnz	w21, LBB0_7
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	x0, x19
	bl	_romsel_loop
	cbz	x0, LBB0_8
; %bb.12:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w1, [x27]
	mov	x0, #0
	bl	_emu_cdCheck
	ldr	w8, [x28]
	cmp	w0, w8
	b.eq	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	x1, x0
	ldr	w0, [x27]
	bl	_Insert_CD
	cbz	w0, LBB0_16
LBB0_14:                                ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x25]
	ldr	q0, [x26]
	ldur	q1, [x26, #15]
	stur	q1, [x8, #15]
	str	q0, [x8]
	ldr	x1, [x25]
	mov	x0, x20
	bl	_lprintf
	mov	w21, #0
	b	LBB0_9
LBB0_15:
	mov	w0, #0
	b	LBB0_17
LBB0_16:
	mov	w0, #1
LBB0_17:
Lloh27:
	adrp	x8, _PGS_RestartRun@GOTPAGE
Lloh28:
	ldr	x8, [x8, _PGS_RestartRun@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
Lloh30:
	adrp	x9, _engineState@GOTPAGE
Lloh31:
	ldr	x9, [x9, _engineState@GOTPAGEOFF]
Lloh32:
	str	w8, [x9]
	ldur	x8, [x29, #-88]
Lloh33:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh34:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh35:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_19
; %bb.18:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_19:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotStr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_PATH,4,2                   ; @MAX_PATH
	.comm	_loadedRomFName,4,2             ; @loadedRomFName
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rb"

	.comm	_PBTN_PLAY,4,2                  ; @PBTN_PLAY
	.comm	_PBTN_UP,4,2                    ; @PBTN_UP
	.comm	_PBTN_DOWN,4,2                  ; @PBTN_DOWN
	.comm	_romFileName,4,2                ; @romFileName
	.comm	_CIT_NOT_CD,4,2                 ; @CIT_NOT_CD
	.comm	_menuErrorMsg,8,3               ; @menuErrorMsg
l_.str.1:                               ; @.str.1
	.asciz	"Load failed, invalid CD image?"

l_.str.2:                               ; @.str.2
	.asciz	"%s\n"

	.comm	_PGS_RestartRun,4,2             ; @PGS_RestartRun
	.comm	_engineState,4,2                ; @engineState
.subsections_via_symbols
