	.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	$1560, %rsp                     ## imm = 0x618
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movl	%edi, %r15d
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_Pico@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	movq	_crashed_940@GOTPCREL(%rip), %r14
	jle	LBB0_3
## %bb.1:
	cmpq	$0, (%r14)
	jne	LBB0_3
## %bb.2:
	cmpl	%r12d, _YM2612Init_940.oldrate(%rip)
	je	LBB0_10
LBB0_3:
	leaq	L_str(%rip), %rdi
	callq	_puts
	leaq	L_.str.1(%rip), %rdi
	movl	$8, %esi
	movl	$8, %edx
	xorl	%eax, %eax
	callq	_printf
	movl	$1, %edi
	movl	$2, %esi
	callq	_reset940
	movl	$1, %edi
	callq	_pause940
	movq	_memregs@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	movabsq	$4294967296, %rcx               ## imm = 0x100000000
	movq	%rcx, 30336(%rax)
	movq	_memregl@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movabsq	$-288230380446679040, %rcx      ## imm = 0xFBFFFFFF00000000
	movq	%rcx, 17668(%rax)
	cmpq	$0, (%r14)
	je	LBB0_9
## %bb.4:
	movl	%r15d, -1588(%rbp)              ## 4-byte Spill
	movl	%r12d, -1592(%rbp)              ## 4-byte Spill
	movq	_CODE940_FILE@GOTPCREL(%rip), %r13
	movq	(%r13), %rsi
	leaq	-1584(%rbp), %rbx
	movq	%rbx, %rdi
	movl	$512, %edx                      ## imm = 0x200
	callq	_emu_make_path
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_12
## %bb.5:
	movq	%rax, %r12
	leaq	-1072(%rbp), %rdi
	movl	$1, %esi
	movl	$1024, %edx                     ## imm = 0x400
	movq	%rax, %rcx
	callq	_fread
	testl	%eax, %eax
	jle	LBB0_8
## %bb.6:
	movl	%eax, %ebx
	xorl	%r14d, %r14d
	movq	_shared_mem@GOTPCREL(%rip), %r15
	leaq	-1072(%rbp), %r13
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%r14d, %r14
	movq	(%r15), %rdi
	addq	%r14, %rdi
	movq	%r13, %rsi
	movl	%ebx, %edx
	callq	_memcpy
	addl	%ebx, %r14d
	movq	%r13, %rdi
	movl	$1, %esi
	movl	$1024, %edx                     ## imm = 0x400
	movq	%r12, %rcx
	callq	_fread
	movl	%eax, %ebx
	testl	%eax, %eax
	jg	LBB0_7
LBB0_8:
	movq	%r12, %rdi
	callq	_fclose
	movq	_crashed_940@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movl	-1592(%rbp), %r12d              ## 4-byte Reload
	movl	-1588(%rbp), %r15d              ## 4-byte Reload
	movq	_memregs@GOTPCREL(%rip), %r13
	movq	_memregl@GOTPCREL(%rip), %rbx
LBB0_9:
	movq	_shared_data@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movq	_shared_ctl@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movl	%r15d, %edi
	movl	%r12d, %esi
	callq	_YM2612Init_
	xorl	%eax, %eax
	callq	_internal_reset
	movq	_loaded_mp3@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	(%r13), %rax
	movl	$65535, 30348(%rax)             ## imm = 0xFFFF
	movq	(%rbx), %rax
	movl	$-1, 17664(%rax)
	movl	$-1, 17680(%rax)
	xorl	%edi, %edi
	movl	$2, %esi
	callq	_reset940
	xorl	%edi, %edi
	callq	_pause940
	movq	(%r14), %rax
	movl	%r15d, (%rax)
	movl	%r12d, 4(%rax)
	movq	_JOB940_INITALL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_add_job_940
	movl	%r12d, _YM2612Init_940.oldrate(%rip)
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_13
## %bb.11:
	addq	$1560, %rsp                     ## imm = 0x618
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	callq	___stack_chk_fail
LBB0_12:
	movq	_g_screen_ptr@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	xorl	%esi, %esi
	movl	$153600, %edx                   ## imm = 0x25800
	callq	_memset
	leaq	L_.str.3(%rip), %rdx
	movl	$10, %edi
	movl	$100, %esi
	callq	_text_out16
	movq	(%r13), %rdx
	movl	$10, %edi
	movl	$110, %esi
	callq	_text_out16
	xorl	%eax, %eax
	callq	_gp2x_video_flip2
	movq	_PBTN_MOK@GOTPCREL(%rip), %rax
	movq	_PBTN_MBACK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	xorl	%esi, %esi
	movl	$100, %edx
	callq	_in_menu_wait
	leaq	L_.str.4(%rip), %rdi
	leaq	-1584(%rbp), %rsi
	xorl	%eax, %eax
	callq	_printf
	movl	$1, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_YM2612Init_940.oldrate,4,2 ## @YM2612Init_940.oldrate
	.comm	_Pico,8,3                       ## @Pico
	.comm	_crashed_940,8,3                ## @crashed_940
	.section	__TEXT,__cstring,cstring_literals
L_.str.1:                               ## @.str.1
	.asciz	"Mem usage: shared_data: %i, shared_ctl: %i\n"

	.comm	_memregs,8,3                    ## @memregs
	.comm	_memregl,8,3                    ## @memregl
	.comm	_CODE940_FILE,8,3               ## @CODE940_FILE
L_.str.2:                               ## @.str.2
	.asciz	"rb"

	.comm	_g_screen_ptr,8,3               ## @g_screen_ptr
L_.str.3:                               ## @.str.3
	.asciz	"failed to open required file:"

	.comm	_PBTN_MOK,4,2                   ## @PBTN_MOK
	.comm	_PBTN_MBACK,4,2                 ## @PBTN_MBACK
L_.str.4:                               ## @.str.4
	.asciz	"failed to open %s\n"

	.comm	_shared_mem,8,3                 ## @shared_mem
	.comm	_shared_data,8,3                ## @shared_data
	.comm	_shared_ctl,8,3                 ## @shared_ctl
	.comm	_loaded_mp3,8,3                 ## @loaded_mp3
	.comm	_JOB940_INITALL,4,2             ## @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
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function YM2612Init_940
lCPI0_0:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
lCPI0_1:
	.long	0                               ; 0x0
	.long	4227858431                      ; 0xfbffffff
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_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, #1568
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	x8, _Pico@GOTPAGE
Lloh4:
	ldr	x8, [x8, _Pico@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
Lloh6:
	adrp	x24, _crashed_940@GOTPAGE
Lloh7:
	ldr	x24, [x24, _crashed_940@GOTPAGEOFF]
	ldr	x9, [x24]
	adrp	x23, _YM2612Init_940.oldrate@PAGE
	ldr	w10, [x23, _YM2612Init_940.oldrate@PAGEOFF]
	cmp	x8, #1
	ccmp	x9, #0, #0, ge
	ccmp	w10, w1, #0, eq
	b.eq	LBB0_8
; %bb.1:
	mov	x19, x1
	mov	x20, x0
Lloh8:
	adrp	x0, l_str@PAGE
Lloh9:
	add	x0, x0, l_str@PAGEOFF
	bl	_puts
	mov	w8, #8
	stp	x8, x8, [sp]
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_printf
	mov	w0, #1
	mov	w1, #2
	bl	_reset940
	mov	w0, #1
	bl	_pause940
Lloh12:
	adrp	x25, _memregs@GOTPAGE
Lloh13:
	ldr	x25, [x25, _memregs@GOTPAGEOFF]
	ldr	x8, [x25]
Lloh14:
	adrp	x9, lCPI0_0@PAGE
Lloh15:
	ldr	d0, [x9, lCPI0_0@PAGEOFF]
	str	d0, [x8, #30336]
Lloh16:
	adrp	x26, _memregl@GOTPAGE
Lloh17:
	ldr	x26, [x26, _memregl@GOTPAGEOFF]
	ldr	x8, [x26]
Lloh18:
	adrp	x9, lCPI0_1@PAGE
Lloh19:
	ldr	d0, [x9, lCPI0_1@PAGEOFF]
	mov	w9, #17668
	str	d0, [x8, x9]
	ldr	x8, [x24]
	cbz	x8, LBB0_7
; %bb.2:
Lloh20:
	adrp	x27, _CODE940_FILE@GOTPAGE
Lloh21:
	ldr	x27, [x27, _CODE940_FILE@GOTPAGEOFF]
	ldr	x1, [x27]
	add	x22, sp, #16
	add	x0, sp, #16
	mov	w2, #512
	bl	_emu_make_path
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	add	x0, sp, #16
	bl	_fopen
	cbz	x0, LBB0_11
; %bb.3:
	mov	x21, x0
	add	x0, sp, #528
	mov	w1, #1
	mov	w2, #1024
	mov	x3, x21
	bl	_fread
	cmp	w0, #1
	b.lt	LBB0_6
; %bb.4:
	mov	x22, x0
	mov	w27, #0
Lloh24:
	adrp	x28, _shared_mem@GOTPAGE
Lloh25:
	ldr	x28, [x28, _shared_mem@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x28]
	add	x0, x8, w27, sxtw
	add	x1, sp, #528
	mov	x2, x22
	bl	_memcpy
	add	w27, w22, w27
	add	x0, sp, #528
	mov	w1, #1
	mov	w2, #1024
	mov	x3, x21
	bl	_fread
	mov	x22, x0
	cmp	w0, #0
	b.gt	LBB0_5
LBB0_6:
	mov	x0, x21
	bl	_fclose
	str	xzr, [x24]
LBB0_7:
Lloh26:
	adrp	x8, _shared_data@GOTPAGE
Lloh27:
	ldr	x8, [x8, _shared_data@GOTPAGEOFF]
Lloh28:
	ldr	x0, [x8]
	mov	w1, #0
	mov	w2, #8
	bl	_memset
Lloh29:
	adrp	x21, _shared_ctl@GOTPAGE
Lloh30:
	ldr	x21, [x21, _shared_ctl@GOTPAGEOFF]
	ldr	x0, [x21]
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	mov	x0, x20
	mov	x1, x19
	bl	_YM2612Init_
	bl	_internal_reset
Lloh31:
	adrp	x8, _loaded_mp3@GOTPAGE
Lloh32:
	ldr	x8, [x8, _loaded_mp3@GOTPAGEOFF]
Lloh33:
	str	xzr, [x8]
	ldr	x8, [x25]
	mov	w9, #30348
	mov	w10, #65535
	str	w10, [x8, x9]
	ldr	x8, [x26]
	mov	w9, #17664
	add	x8, x8, x9
	mov	w9, #-1
	str	w9, [x8]
	str	w9, [x8, #16]
	mov	w0, #0
	mov	w1, #2
	bl	_reset940
	mov	w0, #0
	bl	_pause940
	ldr	x8, [x21]
	stp	w20, w19, [x8]
Lloh34:
	adrp	x8, _JOB940_INITALL@GOTPAGE
Lloh35:
	ldr	x8, [x8, _JOB940_INITALL@GOTPAGEOFF]
Lloh36:
	ldr	w0, [x8]
	bl	_add_job_940
	str	w19, [x23, _YM2612Init_940.oldrate@PAGEOFF]
LBB0_8:
	ldur	x8, [x29, #-96]
Lloh37:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh38:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh39:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_10
; %bb.9:
	add	sp, sp, #1568
	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_10:
	bl	___stack_chk_fail
LBB0_11:
Lloh40:
	adrp	x8, _g_screen_ptr@GOTPAGE
Lloh41:
	ldr	x8, [x8, _g_screen_ptr@GOTPAGEOFF]
Lloh42:
	ldr	x0, [x8]
	mov	w1, #0
	mov	w2, #22528
	movk	w2, #2, lsl #16
	bl	_memset
Lloh43:
	adrp	x2, l_.str.3@PAGE
Lloh44:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	w0, #10
	mov	w1, #100
	bl	_text_out16
	ldr	x2, [x27]
	mov	w0, #10
	mov	w1, #110
	bl	_text_out16
	bl	_gp2x_video_flip2
Lloh45:
	adrp	x8, _PBTN_MOK@GOTPAGE
Lloh46:
	ldr	x8, [x8, _PBTN_MOK@GOTPAGEOFF]
Lloh47:
	ldr	w8, [x8]
Lloh48:
	adrp	x9, _PBTN_MBACK@GOTPAGE
Lloh49:
	ldr	x9, [x9, _PBTN_MBACK@GOTPAGEOFF]
Lloh50:
	ldr	w9, [x9]
	orr	w0, w9, w8
	mov	x1, #0
	mov	w2, #100
	bl	_in_menu_wait
	str	x22, [sp]
Lloh51:
	adrp	x0, l_.str.4@PAGE
Lloh52:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_printf
	mov	w0, #1
	bl	_exit
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdr	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdrp	Lloh14, Lloh18
	.loh AdrpLdr	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotStr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_YM2612Init_940.oldrate,4,2 ; @YM2612Init_940.oldrate
	.comm	_Pico,8,3                       ; @Pico
	.comm	_crashed_940,8,3                ; @crashed_940
	.section	__TEXT,__cstring,cstring_literals
l_.str.1:                               ; @.str.1
	.asciz	"Mem usage: shared_data: %i, shared_ctl: %i\n"

	.comm	_memregs,8,3                    ; @memregs
	.comm	_memregl,8,3                    ; @memregl
	.comm	_CODE940_FILE,8,3               ; @CODE940_FILE
l_.str.2:                               ; @.str.2
	.asciz	"rb"

	.comm	_g_screen_ptr,8,3               ; @g_screen_ptr
l_.str.3:                               ; @.str.3
	.asciz	"failed to open required file:"

	.comm	_PBTN_MOK,4,2                   ; @PBTN_MOK
	.comm	_PBTN_MBACK,4,2                 ; @PBTN_MBACK
l_.str.4:                               ; @.str.4
	.asciz	"failed to open %s\n"

	.comm	_shared_mem,8,3                 ; @shared_mem
	.comm	_shared_data,8,3                ; @shared_data
	.comm	_shared_ctl,8,3                 ; @shared_ctl
	.comm	_loaded_mp3,8,3                 ; @loaded_mp3
	.comm	_JOB940_INITALL,4,2             ; @JOB940_INITALL
l_str:                                  ; @str
	.asciz	"YM2612Init_940()"

.subsections_via_symbols
