	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function snd_es1968_playback_setup
_snd_es1968_playback_setup:             ## @snd_es1968_playback_setup
	.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
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	movl	(%rsi), %eax
	movb	4(%rsi), %cl
	sarl	%cl, %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_ESS_FMT_STEREO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	andl	8(%rsi), %eax
	cmpl	$1, %eax
	movl	$2, %eax
	sbbq	$0, %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$10, %edx
	movl	$36616, %ecx                    ## imm = 0x8F08
	callq	_apu_set_register
LBB0_8:                                 ##   in Loop: Header=BB0_1 Depth=1
	incq	%rbx
	cmpq	%rbx, -72(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_9
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	16(%r14), %rax
	movq	40(%r14), %rcx
	movl	(%rax,%rbx,4), %r15d
	movl	(%rcx), %ecx
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	xorl	%r8d, %r8d
	callq	_snd_es1968_program_wavecache
	movq	40(%r14), %rax
	movl	(%rax), %eax
	subl	16(%r13), %eax
	sarl	%eax
	movl	%eax, %r12d
	orl	$4194304, %r12d                 ## imm = 0x400000
	movl	8(%r14), %ecx
	movq	_ESS_FMT_STEREO@GOTPCREL(%rip), %rdx
	testl	%ecx, (%rdx)
	je	LBB0_3
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	orl	$12582912, %eax                 ## imm = 0xC00000
	testq	%rbx, %rbx
	cmovel	%r12d, %eax
	movq	_ESS_FMT_16BIT@GOTPCREL(%rip), %rdx
	testl	%ecx, (%rdx)
	setne	%cl
	sarl	%cl, %eax
	movl	%eax, %r12d
LBB0_3:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movzwl	%r12w, %ecx
	movq	24(%r14), %rax
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movl	%ecx, (%rax,%rbx,4)
	movl	%ecx, %ebx
	movq	%r13, %rdi
	movl	%r15d, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$1, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$2, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$3, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$4, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$5, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$6, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$7, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$8, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$9, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$10, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$11, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$12, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$13, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$14, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$15, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movl	%r12d, %ecx
	shrl	$8, %ecx
	andl	$65280, %ecx                    ## imm = 0xFF00
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$4, %edx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$5, %edx
	movl	%ebx, %ecx
	callq	_apu_set_register
	movq	%r14, %rbx
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	addl	%r14d, %r12d
	movzwl	%r12w, %ecx
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$6, %edx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$7, %edx
	movl	%r14d, %ecx
	movq	%rbx, %r14
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$8, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$9, %edx
	movl	$53248, %ecx                    ## imm = 0xD000
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$11, %edx
	xorl	%ecx, %ecx
	callq	_apu_set_register
	movq	%r13, %rdi
	movl	%r15d, %esi
	xorl	%edx, %edx
	movl	$16399, %ecx                    ## imm = 0x400F
	callq	_apu_set_register
	movq	_ESS_FMT_16BIT@GOTPCREL(%rip), %r12
	movl	(%r12), %ecx
	movq	_ESM_APU_16BITLINEAR@GOTPCREL(%rip), %rax
	andl	8(%rbx), %ecx
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_ESM_APU_8BITLINEAR@GOTPCREL(%rip), %rax
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	movl	(%rax), %eax
	movq	32(%r14), %rcx
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movl	%eax, (%rcx,%rbx,4)
	movq	_ESS_FMT_STEREO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r14)
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	xorl	%ecx, %ecx
	testq	%rbx, %rbx
	sete	%cl
	shll	$4, %ecx
	orl	$36608, %ecx                    ## imm = 0x8F00
	movq	%r13, %rdi
	movl	%r15d, %esi
	movl	$10, %edx
	callq	_apu_set_register
	movq	32(%r14), %rax
	incl	(%rax,%rbx,4)
	jmp	LBB0_8
LBB0_9:
	movq	%r13, %rdi
	callq	_spin_lock_irqsave
	movq	8(%r13), %rsi
	addq	$4, %rsi
	movl	$1, %edi
	callq	_outw
	movq	_ESM_PORT_HOST_IRQ@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	addq	8(%r13), %rdi
	callq	_inw
	movq	_ESM_HIRQ_DSIE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	(%r15), %rsi
	addq	8(%r13), %rsi
	movl	%eax, %edi
	callq	_outw
	movq	%r13, %rdi
	callq	_spin_unlock_irqrestore
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	cmpl	$48000, %eax                    ## imm = 0xBB80
	movl	$48000, %ecx                    ## imm = 0xBB80
	cmovll	%eax, %ecx
	cmpl	$4001, %ecx                     ## imm = 0xFA1
	movl	$4000, %esi                     ## imm = 0xFA0
	cmovgel	%ecx, %esi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movl	8(%r14), %eax
	testl	%eax, (%r12)
	jne	LBB0_11
## %bb.10:
	movq	_ESS_FMT_STEREO@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	sete	%cl
	shrl	%cl, %esi
LBB0_11:
	movq	%r13, %rdi
	callq	_snd_es1968_compute_rate
	movl	%eax, %r15d
	movq	16(%r14), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%r15d, %edx
	callq	_snd_es1968_apu_set_freq
	movq	16(%r14), %rax
	movl	4(%rax), %esi
	movq	%r13, %rdi
	movl	%r15d, %edx
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_snd_es1968_apu_set_freq        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ESS_FMT_STEREO,4,2             ## @ESS_FMT_STEREO
	.comm	_ESS_FMT_16BIT,4,2              ## @ESS_FMT_16BIT
	.comm	_ESM_APU_16BITLINEAR,4,2        ## @ESM_APU_16BITLINEAR
	.comm	_ESM_APU_8BITLINEAR,4,2         ## @ESM_APU_8BITLINEAR
	.comm	_ESM_PORT_HOST_IRQ,8,3          ## @ESM_PORT_HOST_IRQ
	.comm	_ESM_HIRQ_DSIE,4,2              ## @ESM_HIRQ_DSIE
	.no_dead_strip	_snd_es1968_playback_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function snd_es1968_playback_setup
_snd_es1968_playback_setup:             ; @snd_es1968_playback_setup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	str	x2, [sp, #8]                    ; 8-byte Folded Spill
	mov	x20, x1
	mov	x19, x0
	mov	x22, #0
	ldp	w8, w9, [x1]
	asr	w23, w8, w9
	ldr	w8, [x1, #8]
Lloh0:
	adrp	x25, _ESS_FMT_STEREO@GOTPAGE
Lloh1:
	ldr	x25, [x25, _ESS_FMT_STEREO@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	mov	w8, #1
	cinc	x28, x8, ne
Lloh2:
	adrp	x26, _ESS_FMT_16BIT@GOTPAGE
Lloh3:
	ldr	x26, [x26, _ESS_FMT_16BIT@GOTPAGEOFF]
	b	LBB0_3
LBB0_1:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x19
	mov	x1, x24
	mov	w2, #10
	mov	w3, #36616
	bl	_apu_set_register
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #1
	cmp	x28, x22
	b.eq	LBB0_7
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #16]
	ldr	w24, [x8, x22, lsl #2]
	ldr	x8, [x20, #40]
	ldr	w3, [x8]
	mov	x0, x19
	mov	x1, x20
	mov	x2, x22
	mov	w4, #0
	bl	_snd_es1968_program_wavecache
	ldr	x8, [x20, #40]
	ldr	w8, [x8]
	ldr	w9, [x19, #16]
	sub	w8, w8, w9
	asr	w9, w8, #1
	orr	w27, w9, #0x400000
	ldr	w8, [x20, #8]
	ldr	w10, [x25]
	tst	w10, w8
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	orr	w9, w9, #0xc00000
	cmp	x22, #0
	csel	w9, w27, w9, eq
	ldr	w10, [x26]
	tst	w10, w8
	cset	w8, ne
	asr	w27, w9, w8
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	and	w25, w27, #0xffff
	ldr	x8, [x20, #24]
	lsl	x21, x22, #2
	str	w25, [x8, x21]
	mov	x0, x19
	mov	x1, x24
	mov	w2, #0
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #1
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #2
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #3
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #4
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #5
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #6
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #7
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #8
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #9
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #10
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #11
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #12
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #13
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #14
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #15
	mov	w3, #0
	bl	_apu_set_register
	lsr	w8, w27, #8
	and	w3, w8, #0xff00
	mov	x0, x19
	mov	x1, x24
	mov	w2, #4
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #5
	mov	x3, x25
	bl	_apu_set_register
	add	w8, w27, w23
	and	w3, w8, #0xffff
	mov	x0, x19
	mov	x1, x24
	mov	w2, #6
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #7
	mov	x3, x23
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #8
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #9
	mov	w3, #53248
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #11
	mov	w3, #0
	bl	_apu_set_register
	mov	x0, x19
	mov	x1, x24
	mov	w2, #0
	mov	w3, #16399
	bl	_apu_set_register
	ldr	w8, [x20, #8]
	ldr	w9, [x26]
	tst	w9, w8
Lloh4:
	adrp	x8, _ESM_APU_8BITLINEAR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ESM_APU_8BITLINEAR@GOTPAGEOFF]
Lloh6:
	adrp	x9, _ESM_APU_16BITLINEAR@GOTPAGE
Lloh7:
	ldr	x9, [x9, _ESM_APU_16BITLINEAR@GOTPAGEOFF]
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	ldr	x9, [x20, #32]
	str	w8, [x9, x21]
	ldr	w8, [x20, #8]
Lloh8:
	adrp	x25, _ESS_FMT_STEREO@GOTPAGE
Lloh9:
	ldr	x25, [x25, _ESS_FMT_STEREO@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_1
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	x22, #0
	mov	w8, #36608
	mov	w9, #36624
	csel	w3, w9, w8, eq
	mov	x0, x19
	mov	x1, x24
	mov	w2, #10
	bl	_apu_set_register
	ldr	x8, [x20, #32]
	ldr	w9, [x8, x21]
	add	w9, w9, #1
	str	w9, [x8, x21]
	b	LBB0_2
LBB0_7:
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	x8, [x19, #8]
	add	x1, x8, #4
	mov	w0, #1
	bl	_outw
	ldr	x8, [x19, #8]
Lloh10:
	adrp	x21, _ESM_PORT_HOST_IRQ@GOTPAGE
Lloh11:
	ldr	x21, [x21, _ESM_PORT_HOST_IRQ@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_inw
Lloh12:
	adrp	x8, _ESM_HIRQ_DSIE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ESM_HIRQ_DSIE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	orr	w0, w8, w0
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_outw
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w8, [x8]
	mov	w9, #48000
	cmp	w8, w9
	csel	w8, w8, w9, lt
	mov	w9, #4000
	cmp	w8, #4000
	csel	w1, w8, w9, gt
	ldr	w8, [x20, #8]
	ldr	w9, [x26]
	tst	w9, w8
	b.ne	LBB0_9
; %bb.8:
	ldr	w9, [x25]
	tst	w9, w8
	cset	w8, eq
	lsr	w1, w1, w8
LBB0_9:
	mov	x0, x19
	bl	_snd_es1968_compute_rate
	mov	x21, x0
	ldr	x8, [x20, #16]
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_snd_es1968_apu_set_freq
	ldr	x8, [x20, #16]
	ldr	w1, [x8, #4]
	mov	x0, x19
	mov	x2, x21
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_snd_es1968_apu_set_freq
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_ESS_FMT_STEREO,4,2             ; @ESS_FMT_STEREO
	.comm	_ESS_FMT_16BIT,4,2              ; @ESS_FMT_16BIT
	.comm	_ESM_APU_16BITLINEAR,4,2        ; @ESM_APU_16BITLINEAR
	.comm	_ESM_APU_8BITLINEAR,4,2         ; @ESM_APU_8BITLINEAR
	.comm	_ESM_PORT_HOST_IRQ,8,3          ; @ESM_PORT_HOST_IRQ
	.comm	_ESM_HIRQ_DSIE,4,2              ; @ESM_HIRQ_DSIE
	.no_dead_strip	_snd_es1968_playback_setup
.subsections_via_symbols
