	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PsndGetSamplesMS               ## -- Begin function PsndGetSamplesMS
	.p2align	4, 0x90
_PsndGetSamplesMS:                      ## @PsndGetSamplesMS
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_PicoOpt@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	movl	%eax, %ebx
	shrl	$3, %ebx
	movq	_PsndLen@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r14d
	movq	_PsndLen_exc_add@GOTPCREL(%rip), %rsi
	movq	_PsndLen_exc_cnt@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	addl	(%rsi), %edx
	movl	%edx, (%rcx)
	cmpl	$65536, %edx                    ## imm = 0x10000
	jl	LBB0_2
## %bb.1:
	addl	$-65536, %edx                   ## imm = 0xFFFF0000
	movl	%edx, (%rcx)
	incl	%r14d
LBB0_2:
	andl	$1, %ebx
	movq	_POPT_EN_PSG@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.3:
	movq	_PsndOut@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movl	%r14d, %esi
	movl	%ebx, %edx
	callq	_SN76496Update
LBB0_4:
	testl	%ebx, %ebx
	je	LBB0_18
## %bb.5:
	testl	%r14d, %r14d
	jle	LBB0_18
## %bb.6:
	movq	_PsndOut@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	leal	-1(%r14), %ecx
	cmpl	$7, %ecx
	jae	LBB0_8
## %bb.7:
	movl	%r14d, %ecx
	jmp	LBB0_16
LBB0_8:
	incq	%rcx
	movq	%rcx, %rdx
	andq	$-8, %rdx
	leaq	-8(%rdx), %rsi
	movq	%rsi, %rbx
	shrq	$3, %rbx
	incq	%rbx
	testq	%rsi, %rsi
	je	LBB0_9
## %bb.10:
	movq	%rbx, %rdi
	andq	$-2, %rdi
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movdqu	(%rax,%rsi,4), %xmm0
	movdqu	16(%rax,%rsi,4), %xmm1
	movdqu	32(%rax,%rsi,4), %xmm2
	movdqu	48(%rax,%rsi,4), %xmm3
	movdqa	%xmm0, %xmm4
	pslld	$16, %xmm4
	movdqa	%xmm1, %xmm5
	pslld	$16, %xmm5
	por	%xmm0, %xmm4
	por	%xmm1, %xmm5
	movdqu	%xmm4, (%rax,%rsi,4)
	movdqu	%xmm5, 16(%rax,%rsi,4)
	movdqa	%xmm2, %xmm0
	pslld	$16, %xmm0
	movdqa	%xmm3, %xmm1
	pslld	$16, %xmm1
	por	%xmm2, %xmm0
	por	%xmm3, %xmm1
	movdqu	%xmm0, 32(%rax,%rsi,4)
	movdqu	%xmm1, 48(%rax,%rsi,4)
	addq	$16, %rsi
	addq	$-2, %rdi
	jne	LBB0_11
## %bb.12:
	testb	$1, %bl
	je	LBB0_14
LBB0_13:
	movdqu	(%rax,%rsi,4), %xmm0
	movdqu	16(%rax,%rsi,4), %xmm1
	movdqa	%xmm0, %xmm2
	pslld	$16, %xmm2
	movdqa	%xmm1, %xmm3
	pslld	$16, %xmm3
	por	%xmm0, %xmm2
	por	%xmm1, %xmm3
	movdqu	%xmm2, (%rax,%rsi,4)
	movdqu	%xmm3, 16(%rax,%rsi,4)
LBB0_14:
	cmpq	%rdx, %rcx
	je	LBB0_18
## %bb.15:
	leaq	(%rax,%rdx,4), %rax
	movl	%r14d, %ecx
	subl	%edx, %ecx
LBB0_16:
	incl	%ecx
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rax), %edx
	movl	%edx, %esi
	shll	$16, %esi
	orl	%edx, %esi
	movl	%esi, (%rax)
	addq	$4, %rax
	decl	%ecx
	cmpl	$1, %ecx
	ja	LBB0_17
LBB0_18:
	movq	_POPT_EN_STEREO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	andl	(%r15), %eax
	setne	%cl
	leal	(%rcx,%rcx), %edi
	addl	$2, %edi
	imull	%r14d, %edi
	callq	_PicoWriteSound
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PsndClear                      ## TAILCALL
LBB0_9:
	xorl	%esi, %esi
	testb	$1, %bl
	jne	LBB0_13
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_PicoOpt,4,2                    ## @PicoOpt
	.comm	_PsndLen,4,2                    ## @PsndLen
	.comm	_PsndLen_exc_add,8,3            ## @PsndLen_exc_add
	.comm	_PsndLen_exc_cnt,4,2            ## @PsndLen_exc_cnt
	.comm	_POPT_EN_PSG,4,2                ## @POPT_EN_PSG
	.comm	_PsndOut,8,3                    ## @PsndOut
	.comm	_POPT_EN_STEREO,4,2             ## @POPT_EN_STEREO
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PsndGetSamplesMS               ; -- Begin function PsndGetSamplesMS
	.p2align	2
_PsndGetSamplesMS:                      ; @PsndGetSamplesMS
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
Lloh0:
	adrp	x21, _PicoOpt@GOTPAGE
Lloh1:
	ldr	x21, [x21, _PicoOpt@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh2:
	adrp	x9, _PsndLen@GOTPAGE
Lloh3:
	ldr	x9, [x9, _PsndLen@GOTPAGEOFF]
Lloh4:
	ldr	w19, [x9]
Lloh5:
	adrp	x9, _PsndLen_exc_add@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PsndLen_exc_add@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x9]
Lloh8:
	adrp	x9, _PsndLen_exc_cnt@GOTPAGE
Lloh9:
	ldr	x9, [x9, _PsndLen_exc_cnt@GOTPAGEOFF]
	ldr	w11, [x9]
	add	w10, w11, w10
	str	w10, [x9]
	subs	w10, w10, #16, lsl #12          ; =65536
	b.lt	LBB0_2
; %bb.1:
	str	w10, [x9]
	add	w19, w19, #1
LBB0_2:
	ubfx	w20, w8, #3, #1
Lloh10:
	adrp	x9, _POPT_EN_PSG@GOTPAGE
Lloh11:
	ldr	x9, [x9, _POPT_EN_PSG@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
Lloh13:
	adrp	x22, _PsndOut@GOTPAGE
Lloh14:
	ldr	x22, [x22, _PsndOut@GOTPAGEOFF]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.3:
	ldr	x0, [x22]
	mov	x1, x19
	mov	x2, x20
	bl	_SN76496Update
LBB0_4:
	cmp	w20, #0
	ccmp	w19, #1, #8, ne
	b.lt	LBB0_11
; %bb.5:
	ldr	x12, [x22]
	sub	w10, w19, #1
	mov	x8, x12
	mov	x9, x19
	cmp	w10, #15
	b.lo	LBB0_9
; %bb.6:
	add	x10, x10, #1
	and	x11, x10, #0x1fffffff0
	add	x8, x12, x11, lsl #2
	sub	w9, w19, w11
	add	x12, x12, #32
	mov	x13, x11
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x12, #-32]
	ldp	q2, q3, [x12]
	shl.4s	v4, v0, #16
	shl.4s	v5, v1, #16
	shl.4s	v6, v2, #16
	shl.4s	v7, v3, #16
	orr.16b	v0, v4, v0
	orr.16b	v1, v5, v1
	orr.16b	v2, v6, v2
	orr.16b	v3, v7, v3
	stp	q0, q1, [x12, #-32]
	stp	q2, q3, [x12], #64
	subs	x13, x13, #16
	b.ne	LBB0_7
; %bb.8:
	cmp	x10, x11
	b.eq	LBB0_11
LBB0_9:
	add	w9, w9, #1
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8]
	orr	w10, w10, w10, lsl #16
	str	w10, [x8], #4
	sub	w9, w9, #1
	cmp	w9, #1
	b.hi	LBB0_10
LBB0_11:
	ldr	w8, [x21]
Lloh15:
	adrp	x9, _POPT_EN_STEREO@GOTPAGE
Lloh16:
	ldr	x9, [x9, _POPT_EN_STEREO@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w8
	mov	w8, #4
	mov	w9, #2
	csel	w8, w9, w8, eq
	mul	w0, w8, w19
	bl	_PicoWriteSound
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_PsndClear
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_PicoOpt,4,2                    ; @PicoOpt
	.comm	_PsndLen,4,2                    ; @PsndLen
	.comm	_PsndLen_exc_add,8,3            ; @PsndLen_exc_add
	.comm	_PsndLen_exc_cnt,4,2            ; @PsndLen_exc_cnt
	.comm	_POPT_EN_PSG,4,2                ; @POPT_EN_PSG
	.comm	_PsndOut,8,3                    ; @PsndOut
	.comm	_POPT_EN_STEREO,4,2             ; @POPT_EN_STEREO
.subsections_via_symbols
