	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2612Init_940                 ## -- Begin function YM2612Init_940
	.p2align	4, 0x90
_YM2612Init_940:                        ## @YM2612Init_940
	.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	$2072, %rsp                     ## imm = 0x818
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movl	%edi, %r15d
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	L_str(%rip), %rdi
	callq	_puts
	leaq	L_.str.1(%rip), %rdi
	movl	$24, %esi
	movl	$24, %edx
	xorl	%eax, %eax
	callq	_printf
	movl	$1, %edi
	movl	$2, %esi
	callq	_Reset940
	movl	$1, %edi
	callq	_Pause940
	movq	_gp2x_memregs@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	$65535, 30348(%rax)             ## imm = 0xFFFF
	movl	$65535, 30340(%rax)             ## imm = 0xFFFF
	movq	_gp2x_memregl@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	$-67108865, 17672(%rax)         ## imm = 0xFBFFFFFF
	movq	_shared_mem@GOTPCREL(%rip), %r12
	cmpq	$0, (%r12)
	je	LBB0_1
## %bb.7:
	movq	_crashed_940@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jne	LBB0_8
	jmp	LBB0_15
LBB0_1:
	movl	%r15d, -2100(%rbp)              ## 4-byte Spill
	movl	%r14d, -2104(%rbp)              ## 4-byte Spill
	movq	_PROT_READ@GOTPCREL(%rip), %rax
	movq	_PROT_WRITE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	orl	(%rax), %edx
	movq	_MAP_SHARED@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	movq	_memdev@GOTPCREL(%rip), %r15
	movl	(%r15), %r8d
	xorl	%edi, %edi
	movl	$2162688, %esi                  ## imm = 0x210000
	movl	$33554432, %r9d                 ## imm = 0x2000000
	callq	_mmap
	movq	%rax, (%r12)
	movq	_MAP_FAILED@GOTPCREL(%rip), %r13
	cmpq	%rax, (%r13)
	je	LBB0_2
## %bb.4:
	leaq	1048576(%rax), %rcx
	movq	_shared_data@GOTPCREL(%rip), %rdx
	movq	%rcx, (%rdx)
	addq	$2097152, %rax                  ## imm = 0x200000
	movq	_shared_ctl@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
	movq	_MP3_SIZE_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rbx), %edx
	movq	_PROT_READ@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movl	(%r14), %ecx
	movl	(%r15), %r8d
	xorl	%edi, %edi
	movl	$50331648, %r9d                 ## imm = 0x3000000
	callq	_mmap
	movq	_mp3_mem@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
	cmpq	%rax, (%r13)
	je	LBB0_5
## %bb.6:
	movq	_crashed_940@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movl	-2104(%rbp), %r14d              ## 4-byte Reload
	movl	-2100(%rbp), %r15d              ## 4-byte Reload
LBB0_8:
	movq	_g_argv@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %esi
	leaq	-2096(%rbp), %rbx
	movq	%rbx, %rdi
	movl	$1023, %edx                     ## imm = 0x3FF
	callq	_strncpy
	movb	$0, -1073(%rbp)
	movq	%rbx, %rdi
	callq	_strlen
                                        ## kill: def $eax killed $eax def $rax
	testl	%eax, %eax
	jle	LBB0_13
## %bb.9:
	movl	%eax, %ecx
	addq	%rbp, %rcx
	addq	$-2096, %rcx                    ## imm = 0xF7D0
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movl	%eax, %edx
	cmpb	$47, -2096(%rbp,%rdx)
	je	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	leal	-1(%rax), %edx
	decq	%rcx
	cmpl	$1, %eax
	movl	%edx, %eax
	jg	LBB0_10
	jmp	LBB0_13
LBB0_11:
	movb	$0, (%rcx)
LBB0_13:
	leaq	L_.str.4(%rip), %rsi
	leaq	-2096(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_strcat
	leaq	L_.str.5(%rip), %rsi
	movq	%rbx, %rdi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_17
## %bb.14:
	movq	%rax, %rbx
	movq	(%r12), %rdi
	leaq	-1072(%rbp), %rsi
	movl	$1024, %edx                     ## imm = 0x400
	movq	%rax, %rcx
	callq	_read_to_upper
	movq	%rbx, %rdi
	callq	_fclose
	movq	_crashed_940@GOTPCREL(%rip), %rax
	movl	$0, (%rax)
LBB0_15:
	movq	_shared_data@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	movq	_shared_ctl@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	movq	(%rbx), %rax
	movl	%r15d, (%rax)
	movl	%r14d, 4(%rax)
	movq	_JOB940_INITALL@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	16(%rax), %rdx
	movq	%rcx, (%rdx)
	movq	$0, 8(%rdx)
	movl	$1, 8(%rax)
	xorl	%edi, %edi
	movl	$2, %esi
	callq	_Reset940
	xorl	%edi, %edi
	callq	_Pause940
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_18
## %bb.16:
	addq	$2072, %rsp                     ## imm = 0x818
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	callq	___stack_chk_fail
LBB0_17:
	leaq	L_.str.6(%rip), %rdi
	leaq	-2096(%rbp), %rsi
	xorl	%eax, %eax
	callq	_printf
	movl	$1, %edi
	callq	_exit
LBB0_2:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_3
LBB0_5:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.3(%rip), %rdi
LBB0_3:
	xorl	%eax, %eax
	callq	_printf
	movl	$1, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str.1:                               ## @.str.1
	.asciz	"Mem usage: shared_data: %i, shared_ctl: %i\n"

	.comm	_gp2x_memregs,8,3               ## @gp2x_memregs
	.comm	_gp2x_memregl,8,3               ## @gp2x_memregl
	.comm	_shared_mem,8,3                 ## @shared_mem
	.comm	_PROT_READ,4,2                  ## @PROT_READ
	.comm	_PROT_WRITE,4,2                 ## @PROT_WRITE
	.comm	_MAP_SHARED,4,2                 ## @MAP_SHARED
	.comm	_memdev,4,2                     ## @memdev
	.comm	_MAP_FAILED,8,3                 ## @MAP_FAILED
L_.str.2:                               ## @.str.2
	.asciz	"mmap(shared_data) failed with %i\n"

	.comm	_errno,4,2                      ## @errno
	.comm	_shared_data,8,3                ## @shared_data
	.comm	_shared_ctl,8,3                 ## @shared_ctl
	.comm	_MP3_SIZE_MAX,4,2               ## @MP3_SIZE_MAX
	.comm	_mp3_mem,8,3                    ## @mp3_mem
L_.str.3:                               ## @.str.3
	.asciz	"mmap(mp3_mem) failed with %i\n"

	.comm	_crashed_940,4,2                ## @crashed_940
	.comm	_g_argv,8,3                     ## @g_argv
L_.str.4:                               ## @.str.4
	.asciz	"/code940.bin"

L_.str.5:                               ## @.str.5
	.asciz	"rb"

L_.str.6:                               ## @.str.6
	.asciz	"failed to open %s\n"

	.comm	_JOB940_INITALL,8,3             ## @JOB940_INITALL
L_str:                                  ## @str
	.asciz	"YM2612Init_940()"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2612Init_940                 ; -- Begin function YM2612Init_940
	.p2align	2
_YM2612Init_940:                        ; @YM2612Init_940
	.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, #2080
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
Lloh3:
	adrp	x0, l_str@PAGE
Lloh4:
	add	x0, x0, l_str@PAGEOFF
	bl	_puts
	mov	w8, #24
	stp	x8, x8, [sp]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_printf
	mov	w0, #1
	mov	w1, #2
	bl	_Reset940
	mov	w0, #1
	bl	_Pause940
Lloh7:
	adrp	x8, _gp2x_memregs@GOTPAGE
Lloh8:
	ldr	x8, [x8, _gp2x_memregs@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	mov	w9, #30340
	add	x8, x8, x9
	mov	w9, #65535
	str	w9, [x8, #8]
	str	w9, [x8]
Lloh10:
	adrp	x8, _gp2x_memregl@GOTPAGE
Lloh11:
	ldr	x8, [x8, _gp2x_memregl@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	mov	w9, #17672
	mov	w10, #-67108865
	str	w10, [x8, x9]
Lloh13:
	adrp	x25, _shared_mem@GOTPAGE
Lloh14:
	ldr	x25, [x25, _shared_mem@GOTPAGEOFF]
	ldr	x8, [x25]
Lloh15:
	adrp	x24, _crashed_940@GOTPAGE
Lloh16:
	ldr	x24, [x24, _crashed_940@GOTPAGEOFF]
Lloh17:
	adrp	x26, _shared_data@GOTPAGE
Lloh18:
	ldr	x26, [x26, _shared_data@GOTPAGEOFF]
Lloh19:
	adrp	x22, _shared_ctl@GOTPAGE
Lloh20:
	ldr	x22, [x22, _shared_ctl@GOTPAGEOFF]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w8, [x24]
	cbnz	w8, LBB0_5
	b	LBB0_12
LBB0_2:
Lloh21:
	adrp	x21, _PROT_READ@GOTPAGE
Lloh22:
	ldr	x21, [x21, _PROT_READ@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh23:
	adrp	x26, _PROT_WRITE@GOTPAGE
Lloh24:
	ldr	x26, [x26, _PROT_WRITE@GOTPAGEOFF]
	ldr	w9, [x26]
	orr	w2, w9, w8
Lloh25:
	adrp	x27, _MAP_SHARED@GOTPAGE
Lloh26:
	ldr	x27, [x27, _MAP_SHARED@GOTPAGEOFF]
	ldr	w3, [x27]
Lloh27:
	adrp	x28, _memdev@GOTPAGE
Lloh28:
	ldr	x28, [x28, _memdev@GOTPAGEOFF]
	ldr	w4, [x28]
	mov	w0, #0
	mov	w1, #2162688
	mov	w5, #33554432
	bl	_mmap
	str	x0, [x25]
Lloh29:
	adrp	x23, _MAP_FAILED@GOTPAGE
Lloh30:
	ldr	x23, [x23, _MAP_FAILED@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x8, x0
	b.eq	LBB0_16
; %bb.3:
	add	x8, x0, #256, lsl #12           ; =1048576
Lloh31:
	adrp	x9, _shared_data@GOTPAGE
Lloh32:
	ldr	x9, [x9, _shared_data@GOTPAGEOFF]
Lloh33:
	str	x8, [x9]
	add	x8, x0, #512, lsl #12           ; =2097152
	str	x8, [x22]
Lloh34:
	adrp	x8, _MP3_SIZE_MAX@GOTPAGE
Lloh35:
	ldr	x8, [x8, _MP3_SIZE_MAX@GOTPAGEOFF]
Lloh36:
	ldr	w1, [x8]
	ldr	w8, [x21]
	ldr	w9, [x26]
	orr	w2, w9, w8
	ldr	w3, [x27]
	ldr	w4, [x28]
	mov	w0, #0
	mov	w5, #50331648
	bl	_mmap
Lloh37:
	adrp	x8, _mp3_mem@GOTPAGE
Lloh38:
	ldr	x8, [x8, _mp3_mem@GOTPAGEOFF]
Lloh39:
	str	x0, [x8]
	ldr	x8, [x23]
	cmp	x8, x0
	b.eq	LBB0_17
; %bb.4:
	mov	w8, #1
	str	w8, [x24]
Lloh40:
	adrp	x26, _shared_data@GOTPAGE
Lloh41:
	ldr	x26, [x26, _shared_data@GOTPAGEOFF]
LBB0_5:
Lloh42:
	adrp	x8, _g_argv@GOTPAGE
Lloh43:
	ldr	x8, [x8, _g_argv@GOTPAGEOFF]
Lloh44:
	ldr	x8, [x8]
	ldr	w1, [x8]
	add	x21, sp, #16
	add	x0, sp, #16
	mov	w2, #1023
	bl	_strncpy
	strb	wzr, [sp, #1039]
	add	x0, sp, #16
	bl	_strlen
	cmp	w0, #1
	b.lt	LBB0_10
; %bb.6:
	add	x8, x21, w0, uxtw
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldrb	w9, [x21, w0, uxtw]
	cmp	w9, #47
	b.eq	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	sub	x8, x8, #1
	subs	w0, w0, #1
	b.gt	LBB0_7
	b	LBB0_10
LBB0_9:
	strb	wzr, [x8]
LBB0_10:
Lloh45:
	adrp	x1, l_.str.4@PAGE
Lloh46:
	add	x1, x1, l_.str.4@PAGEOFF
	add	x23, sp, #16
	add	x0, sp, #16
	bl	_strcat
Lloh47:
	adrp	x1, l_.str.5@PAGE
Lloh48:
	add	x1, x1, l_.str.5@PAGEOFF
	add	x0, sp, #16
	bl	_fopen
	cbz	x0, LBB0_15
; %bb.11:
	mov	x21, x0
	ldr	x0, [x25]
	add	x1, sp, #1040
	mov	w2, #1024
	mov	x3, x21
	bl	_read_to_upper
	mov	x0, x21
	bl	_fclose
	str	wzr, [x24]
LBB0_12:
	ldr	x0, [x26]
	mov	w1, #0
	mov	w2, #24
	bl	_memset
	ldr	x0, [x22]
	mov	w1, #0
	mov	w2, #24
	bl	_memset
	ldr	x8, [x22]
	stp	w20, w19, [x8]
Lloh49:
	adrp	x9, _JOB940_INITALL@GOTPAGE
Lloh50:
	ldr	x9, [x9, _JOB940_INITALL@GOTPAGEOFF]
Lloh51:
	ldr	x9, [x9]
	ldr	x10, [x8, #16]
	stp	x9, xzr, [x10]
	mov	w9, #1
	str	w9, [x8, #8]
	mov	w0, #0
	mov	w1, #2
	bl	_Reset940
	mov	w0, #0
	bl	_Pause940
	ldur	x8, [x29, #-96]
Lloh52:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh53:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh54:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	add	sp, sp, #2080
	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_14:
	bl	___stack_chk_fail
LBB0_15:
	str	x23, [sp]
Lloh55:
	adrp	x0, l_.str.6@PAGE
Lloh56:
	add	x0, x0, l_.str.6@PAGEOFF
	b	LBB0_18
LBB0_16:
Lloh57:
	adrp	x8, _errno@GOTPAGE
Lloh58:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh59:
	ldr	w8, [x8]
	str	x8, [sp]
Lloh60:
	adrp	x0, l_.str.2@PAGE
Lloh61:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_18
LBB0_17:
Lloh62:
	adrp	x8, _errno@GOTPAGE
Lloh63:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh64:
	ldr	w8, [x8]
	str	x8, [sp]
Lloh65:
	adrp	x0, l_.str.3@PAGE
Lloh66:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_18:
	bl	_printf
	mov	w0, #1
	bl	_exit
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotStr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotStr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpAdd	Lloh55, Lloh56
	.loh AdrpAdd	Lloh60, Lloh61
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpAdd	Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str.1:                               ; @.str.1
	.asciz	"Mem usage: shared_data: %i, shared_ctl: %i\n"

	.comm	_gp2x_memregs,8,3               ; @gp2x_memregs
	.comm	_gp2x_memregl,8,3               ; @gp2x_memregl
	.comm	_shared_mem,8,3                 ; @shared_mem
	.comm	_PROT_READ,4,2                  ; @PROT_READ
	.comm	_PROT_WRITE,4,2                 ; @PROT_WRITE
	.comm	_MAP_SHARED,4,2                 ; @MAP_SHARED
	.comm	_memdev,4,2                     ; @memdev
	.comm	_MAP_FAILED,8,3                 ; @MAP_FAILED
l_.str.2:                               ; @.str.2
	.asciz	"mmap(shared_data) failed with %i\n"

	.comm	_errno,4,2                      ; @errno
	.comm	_shared_data,8,3                ; @shared_data
	.comm	_shared_ctl,8,3                 ; @shared_ctl
	.comm	_MP3_SIZE_MAX,4,2               ; @MP3_SIZE_MAX
	.comm	_mp3_mem,8,3                    ; @mp3_mem
l_.str.3:                               ; @.str.3
	.asciz	"mmap(mp3_mem) failed with %i\n"

	.comm	_crashed_940,4,2                ; @crashed_940
	.comm	_g_argv,8,3                     ; @g_argv
l_.str.4:                               ; @.str.4
	.asciz	"/code940.bin"

l_.str.5:                               ; @.str.5
	.asciz	"rb"

l_.str.6:                               ; @.str.6
	.asciz	"failed to open %s\n"

	.comm	_JOB940_INITALL,8,3             ; @JOB940_INITALL
l_str:                                  ; @str
	.asciz	"YM2612Init_940()"

.subsections_via_symbols
