	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ScspDoExec
_ScspDoExec:                            ## @ScspDoExec
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	jle	LBB0_1
## %bb.2:
	xorl	%r12d, %r12d
	movq	_scsp@GOTPCREL(%rip), %r15
	movq	_SCSP_INTERRUPT_TIMER_A@GOTPCREL(%rip), %rbx
	leaq	28(%r15), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	leaq	20(%r15), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	12(%r15), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	4(%r15), %eax
	addl	%r14d, %eax
	movzbl	%al, %ecx
	sarl	$8, %eax
	movslq	%eax, %rbx
	movl	%ecx, 4(%r15)
	addq	%rbx, %r12
	movq	%r14, %rdi
	callq	_ScspRunM68K
	movl	24(%r15), %edx
	movq	_SCSP_INTERRUPT_TIMER_A@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_ScspUpdateTimer
	movl	16(%r15), %edx
	movq	_SCSP_INTERRUPT_TIMER_B@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_ScspUpdateTimer
	movl	8(%r15), %edx
	movq	_SCSP_INTERRUPT_TIMER_C@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movq	_SCSP_INTERRUPT_TIMER_A@GOTPCREL(%rip), %rbx
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_ScspUpdateTimer
	subq	%r14, %r13
	jle	LBB0_10
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %eax
	movl	(%rbx), %ecx
	btl	%ecx, %eax
	movq	%r13, %r14
	jae	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	24(%r15), %esi
	movl	28(%r15), %edi
	callq	_ScspTimerCyclesLeft
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_MIN
	movq	%rax, %r14
	movl	(%r15), %eax
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_SCSP_INTERRUPT_TIMER_B@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	btl	%ecx, %eax
	jae	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	16(%r15), %esi
	movl	20(%r15), %edi
	callq	_ScspTimerCyclesLeft
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_MIN
	movq	%rax, %r14
	movl	(%r15), %eax
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_SCSP_INTERRUPT_TIMER_C@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	btl	%ecx, %eax
	jae	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	8(%r15), %esi
	movl	12(%r15), %edi
	callq	_ScspTimerCyclesLeft
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_MIN
	movq	%rax, %r14
	jmp	LBB0_9
LBB0_1:
	xorl	%r12d, %r12d
LBB0_10:
	movq	_scsp_frame_accurate@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_22
## %bb.11:
	movq	_scsp_sound_left@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	leaq	(%rax,%r12), %rbx
	movq	_SCSP_SOUND_BUFSIZE@GOTPCREL(%rip), %rcx
	subq	(%rcx), %rbx
	jle	LBB0_13
## %bb.12:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_SCSPLOG
	movq	(%r14), %rax
	subq	%rbx, %rax
	movq	%rax, (%r14)
LBB0_13:
	testq	%r12, %r12
	jle	LBB0_18
## %bb.14:
	movq	_scsp_sound_genpos@GOTPCREL(%rip), %r13
	movq	(%r13), %rsi
	movq	_scsp_buffer_R@GOTPCREL(%rip), %r15
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_15 Depth=1
	subq	%rsi, %rbx
	cmpq	%rbx, %r12
	cmovlq	%r12, %rbx
	shlq	$3, %rsi
	movq	_scsp_buffer_L@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	%rsi, %rdi
	addq	(%r15), %rsi
	movq	%rbx, %rdx
	callq	_ScspGenerateAudio
	movq	(%r13), %rsi
	addq	%rbx, %rsi
	movq	%rsi, (%r13)
	movq	(%r14), %rax
	addq	%rbx, %rax
	movq	%rax, (%r14)
	subq	%rbx, %r12
	jle	LBB0_18
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	_SCSP_SOUND_BUFSIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	cmpq	%rbx, %rsi
	jl	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	$0, (%r13)
	xorl	%esi, %esi
	jmp	LBB0_17
LBB0_18:
	testq	%rax, %rax
	jle	LBB0_24
## %bb.19:
	movq	_SNDCore@GOTPCREL(%rip), %r15
	movq	_scsp_buffer_L@GOTPCREL(%rip), %r13
	movq	_scsp_buffer_R@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rcx
	xorl	%eax, %eax
	callq	*(%rcx)
	testq	%rax, %rax
	jle	LBB0_24
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	movq	_scsp_sound_genpos@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	movq	(%r14), %rcx
	subq	%rcx, %rsi
	cmpq	%rcx, %rax
	cmovlq	%rax, %rcx
	movq	_SCSP_SOUND_BUFSIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	subq	%rsi, %rbx
	cmpq	%rbx, %rcx
	cmovbq	%rcx, %rbx
	movq	(%r15), %rax
	shlq	$3, %rsi
	movq	(%r13), %rdi
	addq	%rsi, %rdi
	addq	(%r12), %rsi
	movq	%rbx, %rdx
	callq	*8(%rax)
	subq	%rbx, (%r14)
	jg	LBB0_20
	jmp	LBB0_24
LBB0_22:
	movq	_SNDCore@GOTPCREL(%rip), %r14
	movq	(%r14), %rcx
	xorl	%eax, %eax
	callq	*(%rcx)
	testq	%rax, %rax
	je	LBB0_24
## %bb.23:
	movq	_SCSP_SOUND_BUFSIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rbx
	cmpq	%rbx, %rax
	cmovlq	%rax, %rbx
	movq	_scsp_buffer_L@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	movq	_scsp_buffer_R@GOTPCREL(%rip), %r12
	movq	(%r12), %rsi
	movq	%rbx, %rdx
	callq	_ScspGenerateAudio
	movq	(%r14), %rax
	movq	(%r15), %rdi
	movq	(%r12), %rsi
	movq	%rbx, %rdx
	callq	*8(%rax)
LBB0_24:
	movq	_scsp_clock@GOTPCREL(%rip), %rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addl	%ecx, (%rax)
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_scsp,32,2                      ## @scsp
	.comm	_SCSP_INTERRUPT_TIMER_A,4,2     ## @SCSP_INTERRUPT_TIMER_A
	.comm	_SCSP_INTERRUPT_TIMER_B,4,2     ## @SCSP_INTERRUPT_TIMER_B
	.comm	_SCSP_INTERRUPT_TIMER_C,4,2     ## @SCSP_INTERRUPT_TIMER_C
	.comm	_scsp_frame_accurate,8,3        ## @scsp_frame_accurate
	.comm	_scsp_sound_left,8,3            ## @scsp_sound_left
	.comm	_SCSP_SOUND_BUFSIZE,8,3         ## @SCSP_SOUND_BUFSIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"WARNING: Sound buffer overrun, %u samples\n"

	.comm	_scsp_sound_genpos,8,3          ## @scsp_sound_genpos
	.comm	_scsp_buffer_L,8,3              ## @scsp_buffer_L
	.comm	_scsp_buffer_R,8,3              ## @scsp_buffer_R
	.comm	_SNDCore,8,3                    ## @SNDCore
	.comm	_scsp_clock,4,2                 ## @scsp_clock
	.no_dead_strip	_ScspDoExec
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ScspDoExec
_ScspDoExec:                            ; @ScspDoExec
	.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
	mov	x19, x0
	cmp	x0, #1
	b.lt	LBB0_10
; %bb.1:
	mov	x23, #0
Lloh0:
	adrp	x24, _scsp@GOTPAGE
Lloh1:
	ldr	x24, [x24, _scsp@GOTPAGEOFF]
Lloh2:
	adrp	x25, _SCSP_INTERRUPT_TIMER_A@GOTPAGE
Lloh3:
	ldr	x25, [x25, _SCSP_INTERRUPT_TIMER_A@GOTPAGEOFF]
Lloh4:
	adrp	x26, _SCSP_INTERRUPT_TIMER_B@GOTPAGE
Lloh5:
	ldr	x26, [x26, _SCSP_INTERRUPT_TIMER_B@GOTPAGEOFF]
	mov	x20, x19
Lloh6:
	adrp	x27, _SCSP_INTERRUPT_TIMER_C@GOTPAGE
Lloh7:
	ldr	x27, [x27, _SCSP_INTERRUPT_TIMER_C@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x24, #4]
	add	w8, w8, w21
	sbfx	x22, x8, #8, #24
	and	w8, w8, #0xff
	str	w8, [x24, #4]
	sub	x20, x20, x21
	add	x23, x23, x22
	mov	x0, x21
	bl	_ScspRunM68K
	ldr	w2, [x24, #24]
	ldr	w3, [x25]
	add	x1, x24, #28
	mov	x0, x22
	bl	_ScspUpdateTimer
	ldr	w2, [x24, #16]
	ldr	w3, [x26]
	add	x1, x24, #20
	mov	x0, x22
	bl	_ScspUpdateTimer
	ldr	w2, [x24, #8]
	ldr	w3, [x27]
	add	x1, x24, #12
	mov	x0, x22
	bl	_ScspUpdateTimer
	cmp	x20, #0
	b.le	LBB0_11
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x24]
	ldr	w9, [x25]
	lsr	w9, w8, w9
	tbz	w9, #0, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	w1, w0, [x24, #24]
	bl	_ScspTimerCyclesLeft
	mov	x1, x0
	mov	x0, x20
	bl	_MIN
	mov	x21, x0
	ldr	w8, [x24]
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x21, x20
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w9, [x26]
	lsr	w9, w8, w9
	tbz	w9, #0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	w1, w0, [x24, #16]
	bl	_ScspTimerCyclesLeft
	mov	x1, x0
	mov	x0, x21
	bl	_MIN
	mov	x21, x0
	ldr	w8, [x24]
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w9, [x27]
	lsr	w8, w8, w9
	tbz	w8, #0, LBB0_2
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	w1, w0, [x24, #8]
	bl	_ScspTimerCyclesLeft
	mov	x1, x0
	mov	x0, x21
	bl	_MIN
	mov	x21, x0
	b	LBB0_2
LBB0_10:
	mov	x23, #0
LBB0_11:
Lloh8:
	adrp	x8, _scsp_frame_accurate@GOTPAGE
Lloh9:
	ldr	x8, [x8, _scsp_frame_accurate@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	cbz	x8, LBB0_23
; %bb.12:
Lloh11:
	adrp	x21, _scsp_sound_left@GOTPAGE
Lloh12:
	ldr	x21, [x21, _scsp_sound_left@GOTPAGEOFF]
	ldr	x8, [x21]
Lloh13:
	adrp	x22, _SCSP_SOUND_BUFSIZE@GOTPAGE
Lloh14:
	ldr	x22, [x22, _SCSP_SOUND_BUFSIZE@GOTPAGEOFF]
	ldr	x9, [x22]
	add	x10, x8, x23
	subs	x20, x10, x9
	b.le	LBB0_14
; %bb.13:
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_SCSPLOG
	ldr	x8, [x21]
	sub	x8, x8, x20
	str	x8, [x21]
LBB0_14:
Lloh17:
	adrp	x24, _scsp_sound_genpos@GOTPAGE
Lloh18:
	ldr	x24, [x24, _scsp_sound_genpos@GOTPAGEOFF]
Lloh19:
	adrp	x25, _scsp_buffer_L@GOTPAGE
Lloh20:
	ldr	x25, [x25, _scsp_buffer_L@GOTPAGEOFF]
Lloh21:
	adrp	x26, _scsp_buffer_R@GOTPAGE
Lloh22:
	ldr	x26, [x26, _scsp_buffer_R@GOTPAGEOFF]
	cmp	x23, #1
	b.lt	LBB0_19
; %bb.15:
	ldr	x9, [x24]
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=1
	sub	x8, x8, x9
	cmp	x23, x8
	csel	x20, x23, x8, lt
	ldr	x8, [x25]
	lsl	x9, x9, #3
	add	x0, x8, x9
	ldr	x8, [x26]
	add	x1, x8, x9
	mov	x2, x20
	bl	_ScspGenerateAudio
	ldr	x8, [x24]
	add	x9, x8, x20
	str	x9, [x24]
	ldr	x8, [x21]
	add	x8, x8, x20
	str	x8, [x21]
	sub	x23, x23, x20
	cmp	x23, #0
	b.le	LBB0_19
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x22]
	cmp	x9, x8
	b.lt	LBB0_16
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	mov	x9, #0
	str	xzr, [x24]
	b	LBB0_16
LBB0_19:
	cmp	x8, #1
	b.lt	LBB0_25
; %bb.20:
Lloh23:
	adrp	x23, _SNDCore@GOTPAGE
Lloh24:
	ldr	x23, [x23, _SNDCore@GOTPAGEOFF]
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	ldr	x8, [x8]
	blr	x8
	cmp	x0, #1
	b.lt	LBB0_25
; %bb.22:                               ;   in Loop: Header=BB0_21 Depth=1
	ldr	x8, [x24]
	ldr	x9, [x21]
	cmp	x0, x9
	csel	x10, x0, x9, lt
	ldr	x11, [x22]
	sub	x8, x8, x9
	sub	x9, x11, x8
	cmp	x10, x9
	csel	x20, x10, x9, lo
	ldr	x9, [x23]
	ldr	x9, [x9, #8]
	ldr	x10, [x25]
	lsl	x8, x8, #3
	add	x0, x10, x8
	ldr	x10, [x26]
	add	x1, x10, x8
	mov	x2, x20
	blr	x9
	ldr	x8, [x21]
	sub	x8, x8, x20
	str	x8, [x21]
	cmp	x8, #0
	b.gt	LBB0_21
	b	LBB0_25
LBB0_23:
Lloh25:
	adrp	x21, _SNDCore@GOTPAGE
Lloh26:
	ldr	x21, [x21, _SNDCore@GOTPAGEOFF]
	ldr	x8, [x21]
	ldr	x8, [x8]
	blr	x8
	cbz	x0, LBB0_25
; %bb.24:
Lloh27:
	adrp	x8, _SCSP_SOUND_BUFSIZE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _SCSP_SOUND_BUFSIZE@GOTPAGEOFF]
Lloh29:
	ldr	x8, [x8]
	cmp	x0, x8
	csel	x20, x0, x8, lt
Lloh30:
	adrp	x22, _scsp_buffer_L@GOTPAGE
Lloh31:
	ldr	x22, [x22, _scsp_buffer_L@GOTPAGEOFF]
	ldr	x0, [x22]
Lloh32:
	adrp	x23, _scsp_buffer_R@GOTPAGE
Lloh33:
	ldr	x23, [x23, _scsp_buffer_R@GOTPAGEOFF]
	ldr	x1, [x23]
	mov	x2, x20
	bl	_ScspGenerateAudio
	ldr	x8, [x21]
	ldr	x8, [x8, #8]
	ldr	x0, [x22]
	ldr	x1, [x23]
	mov	x2, x20
	blr	x8
LBB0_25:
Lloh34:
	adrp	x8, _scsp_clock@GOTPAGE
Lloh35:
	ldr	x8, [x8, _scsp_clock@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, w19
	str	w9, [x8]
	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
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_scsp,32,2                      ; @scsp
	.comm	_SCSP_INTERRUPT_TIMER_A,4,2     ; @SCSP_INTERRUPT_TIMER_A
	.comm	_SCSP_INTERRUPT_TIMER_B,4,2     ; @SCSP_INTERRUPT_TIMER_B
	.comm	_SCSP_INTERRUPT_TIMER_C,4,2     ; @SCSP_INTERRUPT_TIMER_C
	.comm	_scsp_frame_accurate,8,3        ; @scsp_frame_accurate
	.comm	_scsp_sound_left,8,3            ; @scsp_sound_left
	.comm	_SCSP_SOUND_BUFSIZE,8,3         ; @SCSP_SOUND_BUFSIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"WARNING: Sound buffer overrun, %u samples\n"

	.comm	_scsp_sound_genpos,8,3          ; @scsp_sound_genpos
	.comm	_scsp_buffer_L,8,3              ; @scsp_buffer_L
	.comm	_scsp_buffer_R,8,3              ; @scsp_buffer_R
	.comm	_SNDCore,8,3                    ; @SNDCore
	.comm	_scsp_clock,4,2                 ; @scsp_clock
	.no_dead_strip	_ScspDoExec
.subsections_via_symbols
