	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_detect_system                  ## -- Begin function detect_system
	.p2align	4, 0x90
_detect_system:                         ## @detect_system
	.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	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAGIC_LEN@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	_MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msg_hash_to_str
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_RARCH_LOG
	movq	_MAGIC_NUMBERS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	je	LBB0_8
## %bb.1:
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r14
	movq	_MAGIC_NUMBERS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, 16(%rax,%r13)
	leaq	16(%r13), %r13
	je	LBB0_8
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	8(%rax,%r13), %esi
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_intfstream_seek
	movl	(%r12), %edx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_intfstream_read
	testq	%rax, %rax
	js	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movslq	(%r12), %rdx
	cmpq	%rdx, %rax
	jl	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_MAGIC_NUMBERS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	12(%rax,%r13), %edi
	movq	%r15, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memcmp
	testq	%rax, %rax
	jne	LBB0_7
## %bb.6:
	movl	%r14d, %eax
	movq	_MAGIC_NUMBERS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	shlq	$4, %rax
	movq	(%rcx,%rax), %rax
	jmp	LBB0_12
LBB0_8:
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	$32776, %esi                    ## imm = 0x8008
	callq	_intfstream_seek
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	$8, %edx
	callq	_intfstream_read
	testq	%rax, %rax
	jle	LBB0_13
## %bb.9:
	movb	$0, 8(%r15)
	movq	%r15, %rdi
	callq	_string_is_empty
	testl	%eax, %eax
	je	LBB0_10
LBB0_13:
	movq	_MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msg_hash_to_str
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_RARCH_LOG
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_3:
	movl	%r14d, %eax
	movq	_MAGIC_NUMBERS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	shlq	$4, %rax
	movl	8(%rcx,%rax), %r14d
	movq	_errno@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_strerror
	leaq	L_.str.1(%rip), %rdi
	xorl	%ebx, %ebx
	movl	%r14d, %esi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_RARCH_LOG
	subl	(%r15), %ebx
	jmp	LBB0_14
LBB0_10:
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_string_is_equal
	testq	%rax, %rax
	je	LBB0_13
## %bb.11:
	leaq	l_.str.3(%rip), %rax
LBB0_12:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	xorl	%ebx, %ebx
LBB0_14:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_16
## %bb.15:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAGIC_LEN,4,2                  ## @MAGIC_LEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s\n"

	.comm	_MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS,4,2 ## @MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS
	.comm	_MAGIC_NUMBERS,8,3              ## @MAGIC_NUMBERS
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
L_.str.1:                               ## @.str.1
	.asciz	"Could not read data at offset %d: %s\n"

	.comm	_errno,4,2                      ## @errno
L_.str.2:                               ## @.str.2
	.asciz	"PSP GAME"

	.section	__TEXT,__const
l_.str.3:                               ## @.str.3
	.asciz	"psp\000"

	.comm	_MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM,4,2 ## @MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_detect_system                  ; -- Begin function detect_system
	.p2align	2
_detect_system:                         ; @detect_system
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	sub	sp, sp, #16
	mov	x19, x1
	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, #-72]
Lloh3:
	adrp	x22, _MAGIC_LEN@GOTPAGE
Lloh4:
	ldr	x22, [x22, _MAGIC_LEN@GOTPAGEOFF]
	ldr	w8, [x22]
	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	x20, x9, x8
	mov	sp, x20
Lloh7:
	adrp	x8, _MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	bl	_msg_hash_to_str
	mov	x1, x0
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	bl	_RARCH_LOG
Lloh12:
	adrp	x23, _MAGIC_NUMBERS@GOTPAGE
Lloh13:
	ldr	x23, [x23, _MAGIC_NUMBERS@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	x9, [x8]
Lloh14:
	adrp	x24, _SEEK_SET@GOTPAGE
Lloh15:
	ldr	x24, [x24, _SEEK_SET@GOTPAGEOFF]
	cbz	x9, LBB0_7
; %bb.1:
	mov	x26, #0
	mov	x25, #0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x25, x25, #1
	ldr	x8, [x23]
	add	x9, x8, x26
	ldr	x9, [x9, #16]
	add	x26, x26, #16
	cbz	x9, LBB0_7
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	add	x8, x8, x26
	ldr	w1, [x8, #8]
	ldr	w2, [x24]
	mov	x0, x21
	bl	_intfstream_seek
	ldr	w2, [x22]
	mov	x0, x21
	mov	x1, x20
	bl	_intfstream_read
	tbnz	x0, #63, LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldrsw	x2, [x22]
	cmp	x0, x2
	b.lt	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x23]
	add	x8, x8, x26
	ldr	w0, [x8, #12]
	mov	x1, x20
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_memcmp
	cbnz	x0, LBB0_2
; %bb.6:
	and	x8, x25, #0xffffffff
	ldr	x9, [x23]
	lsl	x8, x8, #4
	ldr	x8, [x9, x8]
	str	x8, [x19]
	b	LBB0_12
LBB0_7:
	ldr	w2, [x24]
	mov	x0, x21
	mov	w1, #32776
	bl	_intfstream_seek
	mov	x0, x21
	mov	x1, x20
	mov	w2, #8
	bl	_intfstream_read
	cmp	x0, #1
	b.lt	LBB0_9
; %bb.8:
	strb	wzr, [x20, #8]
	mov	x0, x20
	bl	_string_is_empty
	cbz	w0, LBB0_14
LBB0_9:
Lloh16:
	adrp	x8, _MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
	bl	_msg_hash_to_str
	mov	x1, x0
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	bl	_RARCH_LOG
Lloh21:
	adrp	x8, _EINVAL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	b	LBB0_11
LBB0_10:
	ldr	x8, [x23]
	add	x8, x8, w25, uxtw #4
	ldr	w19, [x8, #8]
Lloh24:
	adrp	x20, _errno@GOTPAGE
Lloh25:
	ldr	x20, [x20, _errno@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_strerror
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp, #-16]!
Lloh26:
	adrp	x0, l_.str.1@PAGE
Lloh27:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_RARCH_LOG
	add	sp, sp, #16
	ldr	w8, [x20]
LBB0_11:
	neg	w0, w8
LBB0_12:
	ldur	x8, [x29, #-72]
Lloh28:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh29:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_16
; %bb.13:
	sub	sp, x29, #64
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_14:
Lloh31:
	adrp	x1, l_.str.2@PAGE
Lloh32:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_string_is_equal
	cbz	x0, LBB0_9
; %bb.15:
	mov	w0, #0
Lloh33:
	adrp	x8, l_.str.3@PAGE
Lloh34:
	add	x8, x8, l_.str.3@PAGEOFF
	str	x8, [x19]
	b	LBB0_12
LBB0_16:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_MAGIC_LEN,4,2                  ; @MAGIC_LEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s\n"

	.comm	_MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS,4,2 ; @MSG_COMPARING_WITH_KNOWN_MAGIC_NUMBERS
	.comm	_MAGIC_NUMBERS,8,3              ; @MAGIC_NUMBERS
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
l_.str.1:                               ; @.str.1
	.asciz	"Could not read data at offset %d: %s\n"

	.comm	_errno,4,2                      ; @errno
l_.str.2:                               ; @.str.2
	.asciz	"PSP GAME"

	.section	__TEXT,__const
l_.str.3:                               ; @.str.3
	.asciz	"psp\000"

	.comm	_MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM,4,2 ; @MSG_COULD_NOT_FIND_COMPATIBLE_SYSTEM
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
