	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2612PicoStateSave2_940       ## -- Begin function YM2612PicoStateSave2_940
	.p2align	4, 0x90
_YM2612PicoStateSave2_940:              ## @YM2612PicoStateSave2_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
	movl	%esi, %r14d
	movl	%edi, %r15d
	movq	_JOB940_PICOSTATESAVE2@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_add_job_940
	movl	(%rbx), %edi
	callq	_CHECK_BUSY
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movl	(%rbx), %edi
	callq	_wait_busy_940
LBB0_2:
	movq	_shared_ctl@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax), %rbx
	xorl	%eax, %eax
	callq	_YM2612GetRegs
	cmpl	$1095978329, 1024(%rbx)         ## imm = 0x41534D59
	jne	LBB0_4
## %bb.3:
	movq	%rax, %r12
	leaq	1024(%rbx), %r13
	movq	%rax, %rdi
	movq	%rbx, %rsi
	movl	$32, %edx
	callq	_memcpy
	leaq	1024(%r12), %rdi
	movq	%r13, %rsi
	movl	$48, %edx
	callq	_memcpy
	leaq	736(%r12), %rdi
	leaq	736(%rbx), %rsi
	movl	$72, %edx
	callq	_memcpy
	movq	%r12, %rdi
	addq	$1760, %rdi                     ## imm = 0x6E0
	addq	$1760, %rbx                     ## imm = 0x6E0
	movq	%rbx, %rsi
	movl	$72, %edx
	callq	_memcpy
	movl	%r15d, 1056(%r12)
	movl	%r14d, 1072(%r12)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	leaq	L_str(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_puts                           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_JOB940_PICOSTATESAVE2,4,2      ## @JOB940_PICOSTATESAVE2
	.comm	_shared_ctl,8,3                 ## @shared_ctl
	.section	__TEXT,__cstring,cstring_literals
L_str:                                  ## @str
	.asciz	"code940 didn't return valid save data"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2612PicoStateSave2_940       ; -- Begin function YM2612PicoStateSave2_940
	.p2align	2
_YM2612PicoStateSave2_940:              ; @YM2612PicoStateSave2_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	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x21, _JOB940_PICOSTATESAVE2@GOTPAGE
Lloh1:
	ldr	x21, [x21, _JOB940_PICOSTATESAVE2@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_add_job_940
	ldr	w0, [x21]
	bl	_CHECK_BUSY
	cbz	x0, LBB0_2
; %bb.1:
	ldr	w0, [x21]
	bl	_wait_busy_940
LBB0_2:
Lloh2:
	adrp	x8, _shared_ctl@GOTPAGE
Lloh3:
	ldr	x8, [x8, _shared_ctl@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	ldr	x22, [x8]
	bl	_YM2612GetRegs
	ldr	w8, [x22, #1024]
	mov	w9, #19801
	movk	w9, #16723, lsl #16
	cmp	w8, w9
	b.ne	LBB0_4
; %bb.3:
	mov	x21, x0
	add	x23, x22, #1024
	mov	x1, x22
	mov	w2, #32
	bl	_memcpy
	add	x0, x21, #1024
	mov	x1, x23
	mov	w2, #48
	bl	_memcpy
	add	x0, x21, #736
	add	x1, x22, #736
	mov	w2, #72
	bl	_memcpy
	add	x0, x21, #1760
	add	x1, x22, #1760
	mov	w2, #72
	bl	_memcpy
	str	w20, [x21, #1056]
	str	w19, [x21, #1072]
	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
LBB0_4:
Lloh5:
	adrp	x0, l_str@PAGE
Lloh6:
	add	x0, x0, l_str@PAGEOFF
	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
	b	_puts
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_JOB940_PICOSTATESAVE2,4,2      ; @JOB940_PICOSTATESAVE2
	.comm	_shared_ctl,8,3                 ; @shared_ctl
	.section	__TEXT,__cstring,cstring_literals
l_str:                                  ; @str
	.asciz	"code940 didn't return valid save data"

.subsections_via_symbols
