	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function snd_emu10k1_pcm_channel_alloc
_snd_emu10k1_pcm_channel_alloc:         ## @snd_emu10k1_pcm_channel_alloc
	.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
	movq	%rdi, %r13
	cmpl	$1, %esi
	jg	LBB0_3
## %bb.1:
	movq	16(%r13), %rax
	movq	8(%rax), %rsi
	testq	%rsi, %rsi
	je	LBB0_3
## %bb.2:
	movq	24(%r13), %rdi
	callq	_snd_emu10k1_voice_free
	movq	16(%r13), %rax
	movq	$0, 8(%rax)
LBB0_3:
	xorl	%r15d, %r15d
	movl	$0, %eax
	testl	%r14d, %r14d
	jle	LBB0_8
## %bb.4:
	movq	16(%r13), %rcx
	movl	%r14d, %edx
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%rcx,%rax,8)
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	incq	%rax
	cmpq	%rax, %rdx
	jne	LBB0_5
## %bb.7:
	xorl	%r15d, %r15d
	jmp	LBB0_36
LBB0_8:
	cmpl	%r14d, %eax
	je	LBB0_36
## %bb.9:
	movq	16(%r13), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_14
## %bb.10:
	xorl	%ebx, %ebx
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_12 Depth=1
	incq	%rbx
	callq	_ARRAY_SIZE
	cltq
	cmpq	%rax, %rbx
	jge	LBB0_14
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	16(%r13), %rdi
	movq	(%rdi,%rbx,8), %rsi
	testq	%rsi, %rsi
	je	LBB0_11
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	24(%r13), %rdi
	callq	_snd_emu10k1_voice_free
	movq	16(%r13), %rax
	movq	$0, (%rax,%rbx,8)
	movq	16(%r13), %rdi
	jmp	LBB0_11
LBB0_14:
	movq	24(%r13), %rdi
	movq	_PLAYBACK_EMUVOICE@GOTPCREL(%rip), %r12
	movq	(%r13), %rax
	movq	16(%r13), %rcx
	cmpq	(%r12), %rax
	jne	LBB0_16
## %bb.15:
	movq	_EMU10K1_PCM@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_16:
	movq	_EMU10K1_EFX@GOTPCREL(%rip), %rax
LBB0_17:
	movl	(%rax), %esi
	movl	%r14d, %edx
	callq	_snd_emu10k1_voice_alloc
	testl	%eax, %eax
	js	LBB0_27
## %bb.18:
	movq	16(%r13), %rcx
	movq	(%rcx), %rax
	movq	%r13, 8(%rax)
	cmpl	$2, %r14d
	jl	LBB0_24
## %bb.19:
	movl	%r14d, %edx
	decq	%rdx
	movl	$1, %eax
	cmpl	$2, %r14d
	je	LBB0_22
## %bb.20:
	movq	%rdx, %rsi
	andq	$-2, %rsi
	negq	%rsi
	movl	$1, %eax
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movq	24(%r13), %rdi
	movq	(%rcx), %rbx
	movl	(%rbx), %ebx
	addl	%eax, %ebx
	movslq	%ebx, %rbx
	shlq	$4, %rbx
	addq	(%rdi), %rbx
	movq	%rbx, (%rcx,%rax,8)
	movq	16(%r13), %rcx
	movq	(%rcx,%rax,8), %rdi
	movq	%r13, 8(%rdi)
	movq	24(%r13), %rdi
	movq	(%rcx), %rbx
	movl	(%rbx), %ebx
	addl	%eax, %ebx
	incl	%ebx
	movslq	%ebx, %rbx
	shlq	$4, %rbx
	addq	(%rdi), %rbx
	movq	%rbx, 8(%rcx,%rax,8)
	movq	16(%r13), %rcx
	movq	8(%rcx,%rax,8), %rdi
	movq	%r13, 8(%rdi)
	leaq	(%rsi,%rax), %rdi
	addq	$2, %rdi
	addq	$2, %rax
	cmpq	$1, %rdi
	jne	LBB0_21
LBB0_22:
	testb	$1, %dl
	je	LBB0_24
## %bb.23:
	movq	24(%r13), %rdx
	movq	(%rcx), %rsi
	movslq	(%rsi), %rsi
	movslq	%eax, %rdi
	addq	%rsi, %rdi
	shlq	$4, %rdi
	addq	(%rdx), %rdi
	movq	%rdi, (%rcx,%rax,8)
	movq	16(%r13), %rcx
	movq	(%rcx,%rax,8), %rax
	movq	%r13, 8(%rax)
LBB0_24:
	cmpq	$0, 8(%r13)
	jne	LBB0_36
## %bb.25:
	leaq	8(%r13), %rcx
	movq	(%r13), %rax
	movq	24(%r13), %rdi
	cmpq	(%r12), %rax
	jne	LBB0_28
## %bb.26:
	movq	_EMU10K1_PCM@GOTPCREL(%rip), %rax
	jmp	LBB0_29
LBB0_27:
	movl	%eax, %r15d
	jmp	LBB0_36
LBB0_28:
	movq	_EMU10K1_EFX@GOTPCREL(%rip), %rax
LBB0_29:
	movl	(%rax), %esi
	movl	$1, %edx
	callq	_snd_emu10k1_voice_alloc
	testl	%eax, %eax
	js	LBB0_31
## %bb.30:
	movq	8(%r13), %rax
	movq	%r13, 8(%rax)
	movq	_snd_emu10k1_pcm_interrupt@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 4(%rax)
	jmp	LBB0_36
LBB0_31:
	movl	%eax, %r12d
	testl	%r14d, %r14d
	jle	LBB0_35
## %bb.32:
	movl	%r14d, %r14d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_33:                                ## =>This Inner Loop Header: Depth=1
	movq	16(%r13), %rax
	movq	24(%r13), %rdi
	movq	(%rax,%rbx,8), %rsi
	callq	_snd_emu10k1_voice_free
	movq	16(%r13), %rax
	movq	$0, (%rax,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %r14
	jne	LBB0_33
LBB0_35:
	movl	%r12d, %r15d
LBB0_36:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PLAYBACK_EMUVOICE,8,3          ## @PLAYBACK_EMUVOICE
	.comm	_EMU10K1_PCM,4,2                ## @EMU10K1_PCM
	.comm	_EMU10K1_EFX,4,2                ## @EMU10K1_EFX
	.comm	_snd_emu10k1_pcm_interrupt,4,2  ## @snd_emu10k1_pcm_interrupt
	.no_dead_strip	_snd_emu10k1_pcm_channel_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function snd_emu10k1_pcm_channel_alloc
_snd_emu10k1_pcm_channel_alloc:         ; @snd_emu10k1_pcm_channel_alloc
	.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	x20, x1
	mov	x19, x0
	cmp	w1, #1
	b.gt	LBB0_3
; %bb.1:
	ldr	x8, [x19, #16]
	ldr	x1, [x8, #8]
	cbz	x1, LBB0_3
; %bb.2:
	ldr	x0, [x19, #24]
	bl	_snd_emu10k1_voice_free
	ldr	x8, [x19, #16]
	str	xzr, [x8, #8]
LBB0_3:
	cmp	w20, #1
	b.lt	LBB0_7
; %bb.4:
	mov	x8, #0
	ldr	x9, [x19, #16]
	mov	w10, w20
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x9, x8, lsl #3]
	cbz	x11, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x8, x8, #1
	cmp	x10, x8
	b.ne	LBB0_5
	b	LBB0_19
LBB0_7:
	mov	w8, #0
LBB0_8:
	cmp	w8, w20
	b.eq	LBB0_19
; %bb.9:
	ldr	x0, [x19, #16]
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_14
; %bb.10:
	mov	x21, #0
	b	LBB0_12
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	add	x21, x21, #1
	bl	_ARRAY_SIZE
	cmp	x21, w0, sxtw
	b.ge	LBB0_14
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x19, #16]
	ldr	x1, [x0, x21, lsl #3]
	cbz	x1, LBB0_11
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	x0, [x19, #24]
	bl	_snd_emu10k1_voice_free
	ldr	x8, [x19, #16]
	str	xzr, [x8, x21, lsl #3]
	ldr	x0, [x19, #16]
	b	LBB0_11
LBB0_14:
	ldr	x8, [x19]
Lloh0:
	adrp	x22, _PLAYBACK_EMUVOICE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _PLAYBACK_EMUVOICE@GOTPAGEOFF]
Lloh2:
	adrp	x23, _EMU10K1_PCM@GOTPAGE
Lloh3:
	ldr	x23, [x23, _EMU10K1_PCM@GOTPAGEOFF]
Lloh4:
	adrp	x24, _EMU10K1_EFX@GOTPAGE
Lloh5:
	ldr	x24, [x24, _EMU10K1_EFX@GOTPAGEOFF]
	ldr	x9, [x22]
	cmp	x8, x9
	csel	x8, x23, x24, eq
	ldr	w1, [x8]
	ldp	x3, x0, [x19, #16]
	mov	x2, x20
	bl	_snd_emu10k1_voice_alloc
	tbnz	w0, #31, LBB0_21
; %bb.15:
	ldr	x8, [x19, #16]
	ldr	x9, [x8]
	str	x19, [x9, #8]
	cmp	w20, #2
	b.lt	LBB0_18
; %bb.16:
	mov	w9, w20
	mov	w10, #1
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x19, #24]
	ldr	x11, [x11]
	ldr	x12, [x8]
	ldr	w12, [x12]
	add	w12, w10, w12
	add	x11, x11, w12, sxtw #4
	lsl	x12, x10, #3
	str	x11, [x8, x12]
	ldr	x8, [x19, #16]
	ldr	x11, [x8, x12]
	str	x19, [x11, #8]
	add	x10, x10, #1
	cmp	x9, x10
	b.ne	LBB0_17
LBB0_18:
	mov	x3, x19
	ldr	x8, [x3, #8]!
	cbz	x8, LBB0_22
LBB0_19:
	mov	w21, #0
LBB0_20:
	mov	x0, x21
	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_21:
	mov	x21, x0
	b	LBB0_20
LBB0_22:
	ldr	x0, [x19, #24]
	ldr	x8, [x19]
	ldr	x9, [x22]
	cmp	x8, x9
	csel	x8, x23, x24, eq
	ldr	w1, [x8]
	mov	w2, #1
	bl	_snd_emu10k1_voice_alloc
	tbnz	w0, #31, LBB0_24
; %bb.23:
	mov	w21, #0
	ldr	x8, [x19, #8]
	str	x19, [x8, #8]
Lloh6:
	adrp	x9, _snd_emu10k1_pcm_interrupt@GOTPAGE
Lloh7:
	ldr	x9, [x9, _snd_emu10k1_pcm_interrupt@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	str	w9, [x8, #4]
	b	LBB0_20
LBB0_24:
	mov	x21, x0
	cmp	w20, #1
	b.lt	LBB0_20
; %bb.25:
	mov	x22, #0
	mov	w8, w20
	lsl	x20, x8, #3
LBB0_26:                                ; =>This Inner Loop Header: Depth=1
	ldp	x8, x0, [x19, #16]
	ldr	x1, [x8, x22]
	bl	_snd_emu10k1_voice_free
	ldr	x8, [x19, #16]
	str	xzr, [x8, x22]
	add	x22, x22, #8
	cmp	x20, x22
	b.ne	LBB0_26
	b	LBB0_20
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_PLAYBACK_EMUVOICE,8,3          ; @PLAYBACK_EMUVOICE
	.comm	_EMU10K1_PCM,4,2                ; @EMU10K1_PCM
	.comm	_EMU10K1_EFX,4,2                ; @EMU10K1_EFX
	.comm	_snd_emu10k1_pcm_interrupt,4,2  ; @snd_emu10k1_pcm_interrupt
	.no_dead_strip	_snd_emu10k1_pcm_channel_alloc
.subsections_via_symbols
