	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2612PicoStateLoad2_940       ## -- Begin function YM2612PicoStateLoad2_940
	.p2align	4, 0x90
_YM2612PicoStateLoad2_940:              ## @YM2612PicoStateLoad2_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r13
	xorl	%eax, %eax
	callq	_YM2612GetRegs
	movl	$-1, %ebx
	cmpl	$1095978329, 1024(%rax)         ## imm = 0x41534D59
	jne	LBB0_7
## %bb.1:
	movq	%rax, %r12
	movq	_shared_ctl@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	1056(%r12), %eax
	movl	%eax, (%r13)
	movl	1072(%r12), %eax
	movl	%eax, (%r15)
	movq	_JOB940_YM2612UPDATEONE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_CHECK_BUSY
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movl	(%rbx), %edi
	callq	_wait_busy_940
LBB0_3:
	movq	(%r14), %rax
	xorl	%ecx, %ecx
	cmpl	$1, 8(%rax)
	setne	%cl
	shlq	$4, %rcx
	movq	(%rax,%rcx), %rcx
	movq	_writebuff_ptr@GOTPCREL(%rip), %rdx
	movzwl	(%rdx), %esi
	movl	$65535, (%rcx,%rsi,4)           ## imm = 0xFFFF
	xorb	$1, 8(%rax)
	movl	$0, (%rdx)
	movq	_JOB940_PICOSTATELOAD2_PREP@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_add_job_940
	movl	(%rbx), %edi
	callq	_CHECK_BUSY
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movl	(%rbx), %edi
	callq	_wait_busy_940
LBB0_5:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rsi
	movl	$512, %edx                      ## imm = 0x200
	callq	_memcpy
	movq	_JOB940_PICOSTATELOAD2@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	callq	_add_job_940
	movl	(%r14), %edi
	callq	_CHECK_BUSY
	xorl	%ebx, %ebx
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movl	(%r14), %edi
	callq	_wait_busy_940
LBB0_7:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_shared_ctl,8,3                 ## @shared_ctl
	.comm	_JOB940_YM2612UPDATEONE,4,2     ## @JOB940_YM2612UPDATEONE
	.comm	_writebuff_ptr,4,2              ## @writebuff_ptr
	.comm	_JOB940_PICOSTATELOAD2_PREP,4,2 ## @JOB940_PICOSTATELOAD2_PREP
	.comm	_JOB940_PICOSTATELOAD2,4,2      ## @JOB940_PICOSTATELOAD2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2612PicoStateLoad2_940       ; -- Begin function YM2612PicoStateLoad2_940
	.p2align	2
_YM2612PicoStateLoad2_940:              ; @YM2612PicoStateLoad2_940
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x1
	mov	x22, x0
	bl	_YM2612GetRegs
	ldr	w8, [x0, #1024]
	mov	w9, #19801
	movk	w9, #16723, lsl #16
	cmp	w8, w9
	b.ne	LBB0_7
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x23, _shared_ctl@GOTPAGE
Lloh1:
	ldr	x23, [x23, _shared_ctl@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	x20, [x8]
	ldr	w8, [x0, #1056]
	str	w8, [x22]
	ldr	w8, [x0, #1072]
	str	w8, [x21]
Lloh2:
	adrp	x21, _JOB940_YM2612UPDATEONE@GOTPAGE
Lloh3:
	ldr	x21, [x21, _JOB940_YM2612UPDATEONE@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_CHECK_BUSY
	cbz	x0, LBB0_3
; %bb.2:
	ldr	w0, [x21]
	bl	_wait_busy_940
LBB0_3:
	ldr	x8, [x23]
	ldr	w9, [x8, #8]
	cmp	w9, #1
	cset	w9, ne
	lsl	x9, x9, #4
	ldr	x9, [x8, x9]
Lloh4:
	adrp	x10, _writebuff_ptr@GOTPAGE
Lloh5:
	ldr	x10, [x10, _writebuff_ptr@GOTPAGEOFF]
	ldrh	w11, [x10]
	mov	w12, #65535
	str	w12, [x9, x11, lsl #2]
	ldr	w9, [x8, #8]
	eor	w9, w9, #0x1
	str	w9, [x8, #8]
	str	wzr, [x10]
Lloh6:
	adrp	x21, _JOB940_PICOSTATELOAD2_PREP@GOTPAGE
Lloh7:
	ldr	x21, [x21, _JOB940_PICOSTATELOAD2_PREP@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_add_job_940
	ldr	w0, [x21]
	bl	_CHECK_BUSY
	cbz	x0, LBB0_5
; %bb.4:
	ldr	w0, [x21]
	bl	_wait_busy_940
LBB0_5:
	mov	x0, x20
	mov	x1, x19
	mov	w2, #512
	bl	_memcpy
Lloh8:
	adrp	x19, _JOB940_PICOSTATELOAD2@GOTPAGE
Lloh9:
	ldr	x19, [x19, _JOB940_PICOSTATELOAD2@GOTPAGEOFF]
	ldr	w0, [x19]
	bl	_add_job_940
	ldr	w0, [x19]
	bl	_CHECK_BUSY
	cbz	x0, LBB0_8
; %bb.6:
	ldr	w0, [x19]
	bl	_wait_busy_940
	mov	w0, #0
	b	LBB0_8
LBB0_7:
	mov	w0, #-1
LBB0_8:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_shared_ctl,8,3                 ; @shared_ctl
	.comm	_JOB940_YM2612UPDATEONE,4,2     ; @JOB940_YM2612UPDATEONE
	.comm	_writebuff_ptr,4,2              ; @writebuff_ptr
	.comm	_JOB940_PICOSTATELOAD2_PREP,4,2 ; @JOB940_PICOSTATELOAD2_PREP
	.comm	_JOB940_PICOSTATELOAD2,4,2      ; @JOB940_PICOSTATELOAD2
.subsections_via_symbols
