	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SYSROM_FindInDir               ## -- Begin function SYSROM_FindInDir
	.p2align	4, 0x90
_SYSROM_FindInDir:                      ## @SYSROM_FindInDir
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_TRUE@GOTPCREL(%rip), %rcx
	testl	%esi, %esi
	je	LBB0_2
## %bb.1:
	movq	_num_unset_roms@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_30
LBB0_2:
	movq	%r15, %rdi
	callq	_opendir
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %rbx
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	movq	%rax, %rdi
	callq	_readdir
	testq	%rax, %rax
	je	LBB0_29
## %bb.5:
	movq	%rax, %r13
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	%rbx, %rdi
	callq	_fclose
LBB0_28:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	-80(%rbp), %rsp                 ## 8-byte Reload
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_readdir
	movq	%rax, %r13
	testq	%rax, %rax
	je	LBB0_29
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
                                        ##     Child Loop BB0_24 Depth 2
	movq	%rsp, -80(%rbp)                 ## 8-byte Spill
	movq	_FILENAME_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movq	(%r13), %rdx
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_Util_catpath
	movq	%r12, %rdi
	leaq	L_.str(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_28
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_Util_flen
	movl	%eax, %r14d
	movl	%eax, %edi
	callq	_IsLengthAllowed
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rbx, %rdi
	callq	_Util_rewind
	movq	%rbx, %rdi
	leaq	-88(%rbp), %rsi
	callq	_CRC32_FromFile
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_fclose
	testl	%r15d, %r15d
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_28
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_SYSROM_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_20
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_SYSROM_roms@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_CRC_NULL@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	-88(%rbp), %rsi
	addq	$24, %rcx
	xorl	%r15d, %r15d
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_12 Depth=2
	incq	%r15
	addq	$32, %rcx
	cmpq	%r15, %rax
	je	LBB0_19
LBB0_12:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	testl	%ebx, %ebx
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=2
	cmpq	$0, (%rcx)
	je	LBB0_18
LBB0_14:                                ##   in Loop: Header=BB0_12 Depth=2
	cmpl	%r14d, -24(%rcx)
	jne	LBB0_18
## %bb.15:                              ##   in Loop: Header=BB0_12 Depth=2
	movq	-16(%rcx), %rdi
	cmpq	%rdx, %rdi
	je	LBB0_18
## %bb.16:                              ##   in Loop: Header=BB0_12 Depth=2
	cmpq	%rsi, %rdi
	jne	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	-8(%rcx), %edi
	movq	%r12, %rsi
	callq	_strcpy
	movl	%r15d, %edi
	callq	_ClearUnsetFlag
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	testl	%eax, %eax
	jne	LBB0_28
	jmp	LBB0_22
LBB0_19:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	-64(%rbp), %r15                 ## 8-byte Reload
LBB0_20:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	-56(%rbp), %eax                 ## 4-byte Reload
	testl	%eax, %eax
	jne	LBB0_28
LBB0_22:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	(%r13), %rbx
	movb	(%rbx), %al
	testb	%al, %al
	je	LBB0_26
## %bb.23:                              ##   in Loop: Header=BB0_6 Depth=1
	incq	%rbx
	.p2align	4, 0x90
LBB0_24:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movsbl	%al, %edi
	callq	_tolower
	movb	%al, -1(%rbx)
	movzbl	(%rbx), %eax
	incq	%rbx
	testb	%al, %al
	jne	LBB0_24
## %bb.25:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	(%r13), %rbx
LBB0_26:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	%rbx, %rdi
	movl	%r14d, %esi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	callq	_MatchByName
	testl	%eax, %eax
	js	LBB0_28
## %bb.27:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	%eax, %ebx
	movq	_SYSROM_roms@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%ebx, %ecx
	shlq	$5, %rcx
	movl	16(%rax,%rcx), %edi
	movq	%r12, %rsi
	callq	_strcpy
	movl	%ebx, %edi
	callq	_ClearUnsetFlag
	jmp	LBB0_28
LBB0_29:
	movq	%rbx, %rdi
	callq	_closedir
	movq	_TRUE@GOTPCREL(%rip), %rcx
	jmp	LBB0_30
LBB0_3:
	movq	_FALSE@GOTPCREL(%rip), %rcx
LBB0_30:
	movl	(%rcx), %eax
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_32
## %bb.31:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_32:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_num_unset_roms,8,3             ## @num_unset_roms
	.comm	_TRUE,4,2                       ## @TRUE
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_FILENAME_MAX,4,2               ## @FILENAME_MAX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rb"

	.comm	_SYSROM_SIZE,4,2                ## @SYSROM_SIZE
	.comm	_SYSROM_roms,8,3                ## @SYSROM_roms
	.comm	_CRC_NULL,8,3                   ## @CRC_NULL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SYSROM_FindInDir               ; -- Begin function SYSROM_FindInDir
	.p2align	2
_SYSROM_FindInDir:                      ; @SYSROM_FindInDir
	.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, #32
	mov	x19, x1
	stur	x0, [x29, #-104]                ; 8-byte Folded Spill
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	x9, _TRUE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _TRUE@GOTPAGEOFF]
	cbz	w1, LBB0_2
; %bb.1:
Lloh5:
	adrp	x8, _num_unset_roms@GOTPAGE
Lloh6:
	ldr	x8, [x8, _num_unset_roms@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cbz	x8, LBB0_27
LBB0_2:
	ldur	x0, [x29, #-104]                ; 8-byte Folded Reload
	bl	_opendir
Lloh8:
	adrp	x25, _FALSE@GOTPAGE
Lloh9:
	ldr	x25, [x25, _FALSE@GOTPAGEOFF]
	cbz	x0, LBB0_26
; %bb.3:
	mov	x21, x0
	bl	_readdir
	cbz	x0, LBB0_25
; %bb.4:
	mov	x24, x0
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x0, x26
	bl	_fclose
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	sp, x22
	mov	x0, x21
	bl	_readdir
	mov	x24, x0
	mov	x25, x20
	cbz	x0, LBB0_25
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_13 Depth 2
                                        ;     Child Loop BB0_21 Depth 2
	mov	x22, sp
Lloh10:
	adrp	x8, _FILENAME_MAX@GOTPAGE
Lloh11:
	ldr	x8, [x8, _FILENAME_MAX@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	mov	x9, x8
Lloh13:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh14:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x1fffffff0
	sub	x23, x9, x8
	mov	sp, x23
	mov	x20, x25
	ldr	w28, [x25]
	ldr	x2, [x24]
	mov	x0, x23
	ldur	x1, [x29, #-104]                ; 8-byte Folded Reload
	bl	_Util_catpath
	mov	x0, x23
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x26, x0
	bl	_Util_flen
	mov	x25, x0
	bl	_IsLengthAllowed
	cbz	w0, LBB0_5
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x0, x26
	bl	_Util_rewind
	sub	x1, x29, #96
	mov	x0, x26
	bl	_CRC32_FromFile
	mov	x27, x0
	mov	x0, x26
	bl	_fclose
	cbz	w27, LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
Lloh17:
	adrp	x8, _SYSROM_SIZE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SYSROM_SIZE@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	mov	x26, #0
Lloh20:
	adrp	x9, _SYSROM_roms@GOTPAGE
Lloh21:
	ldr	x9, [x9, _SYSROM_roms@GOTPAGEOFF]
Lloh22:
	ldr	x10, [x9]
Lloh23:
	adrp	x9, _CRC_NULL@GOTPAGE
Lloh24:
	ldr	x9, [x9, _CRC_NULL@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	ldur	x11, [x29, #-96]
	add	x10, x10, #16
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=2
	add	x26, x26, #1
	add	x10, x10, #32
	cmp	x8, x26
	b.eq	LBB0_18
LBB0_13:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cbz	w19, LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=2
	ldr	x12, [x10, #8]
	cbz	x12, LBB0_12
LBB0_15:                                ;   in Loop: Header=BB0_13 Depth=2
	ldur	w12, [x10, #-16]
	cmp	w12, w25
	b.ne	LBB0_12
; %bb.16:                               ;   in Loop: Header=BB0_13 Depth=2
	ldur	x12, [x10, #-8]
	cmp	x12, x9
	ccmp	x12, x11, #0, ne
	b.ne	LBB0_12
; %bb.17:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	w0, [x10]
	mov	x1, x23
	bl	_strcpy
	mov	x0, x26
	bl	_ClearUnsetFlag
Lloh26:
	adrp	x8, _TRUE@GOTPAGE
Lloh27:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh28:
	ldr	w28, [x8]
LBB0_18:                                ;   in Loop: Header=BB0_7 Depth=1
	cbnz	w28, LBB0_6
; %bb.19:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	x0, [x24]
	ldrb	w8, [x0]
	cbz	w8, LBB0_23
; %bb.20:                               ;   in Loop: Header=BB0_7 Depth=1
	add	x26, x0, #1
LBB0_21:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	sxtb	w0, w8
	bl	_tolower
	sturb	w0, [x26, #-1]
	ldrb	w8, [x26], #1
	cbnz	w8, LBB0_21
; %bb.22:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	x0, [x24]
LBB0_23:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x1, x25
	mov	x2, x19
	bl	_MatchByName
	tbnz	w0, #31, LBB0_6
; %bb.24:                               ;   in Loop: Header=BB0_7 Depth=1
	mov	x24, x0
Lloh29:
	adrp	x8, _SYSROM_roms@GOTPAGE
Lloh30:
	ldr	x8, [x8, _SYSROM_roms@GOTPAGEOFF]
Lloh31:
	ldr	x8, [x8]
	mov	w9, w0
	add	x8, x8, x9, lsl #5
	ldr	w0, [x8, #16]
	mov	x1, x23
	bl	_strcpy
	mov	x0, x24
	bl	_ClearUnsetFlag
	b	LBB0_6
LBB0_25:
	mov	x0, x21
	bl	_closedir
Lloh32:
	adrp	x9, _TRUE@GOTPAGE
Lloh33:
	ldr	x9, [x9, _TRUE@GOTPAGEOFF]
	b	LBB0_27
LBB0_26:
	mov	x9, x25
LBB0_27:
	ldr	w0, [x9]
	ldur	x8, [x29, #-88]
Lloh34:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh35:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh36:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_29
; %bb.28:
	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_29:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_num_unset_roms,8,3             ; @num_unset_roms
	.comm	_TRUE,4,2                       ; @TRUE
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_FILENAME_MAX,4,2               ; @FILENAME_MAX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rb"

	.comm	_SYSROM_SIZE,4,2                ; @SYSROM_SIZE
	.comm	_SYSROM_roms,8,3                ; @SYSROM_roms
	.comm	_CRC_NULL,8,3                   ; @CRC_NULL
.subsections_via_symbols
