	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function voice_alloc
_voice_alloc:                           ## @voice_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	%rbx
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $esi killed $esi def $rsi
	movq	$0, (%rcx)
	movq	_NUM_G@GOTPCREL(%rip), %r10
	movl	(%r10), %r11d
	testl	%r11d, %r11d
	jle	LBB0_13
## %bb.1:
	movl	%edx, %r8d
	movl	(%rdi), %r9d
	xorl	%r14d, %r14d
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
	movl	%r9d, %eax
	cltd
	idivl	%r11d
	movl	%edx, %r9d
	cmpl	$2, %r8d
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r9d, %eax
	andl	$1, %eax
	je	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	incl	%r9d
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	addl	%r8d, %r9d
	addl	%r8d, %r14d
	cmpl	%r11d, %r14d
	jl	LBB0_2
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	testl	%r8d, %r8d
	jle	LBB0_10
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	8(%rdi), %r15
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	leal	(%r9,%rbx), %eax
	cltd
	idivl	%r11d
	movslq	%edx, %rax
	leaq	(%rax,%rax,4), %rax
	cmpl	$0, (%r15,%rax,4)
	jne	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_8 Depth=2
	incl	%ebx
	cmpl	%ebx, %r8d
	jne	LBB0_8
## %bb.12:
	leal	(%r9,%r8), %eax
	cltd
	idivl	%r11d
	movl	%edx, (%rdi)
	cmpl	%edx, %r9d
	jne	LBB0_14
LBB0_13:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_24
LBB0_14:
	movq	8(%rdi), %rbx
	addl	$-128, %esi
	leaq	LJTI0_0(%rip), %r11
	movl	%r9d, %edi
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_15 Depth=1
	leaq	(%rbx,%rax,4), %rax
	addq	$16, %rax
LBB0_21:                                ##   in Loop: Header=BB0_15 Depth=1
	movl	$1, (%rax)
LBB0_22:                                ##   in Loop: Header=BB0_15 Depth=1
	incl	%edi
	decl	%r8d
	je	LBB0_23
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movl	%edi, %eax
	cltd
	idivl	(%r10)
	movslq	%edx, %rax
	leaq	(%rax,%rax,4), %rax
	movl	$1, (%rbx,%rax,4)
	cmpl	$3, %esi
	ja	LBB0_22
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movslq	(%r11,%rsi,4), %rdx
	addq	%r11, %rdx
	jmpq	*%rdx
LBB0_18:                                ##   in Loop: Header=BB0_15 Depth=1
	leaq	(%rbx,%rax,4), %rax
	addq	$8, %rax
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_15 Depth=1
	leaq	(%rbx,%rax,4), %rax
	addq	$4, %rax
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_15 Depth=1
	leaq	(%rbx,%rax,4), %rax
	addq	$12, %rax
	jmp	LBB0_21
LBB0_10:
	addl	%r9d, %r8d
	movl	%r8d, %eax
	cltd
	idivl	%r11d
	movl	%edx, (%rdi)
	cmpl	%edx, %r9d
	je	LBB0_13
## %bb.11:
	movq	8(%rdi), %rbx
LBB0_23:
	movslq	%r9d, %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rbx,%rax,4), %rax
	movq	%rax, (%rcx)
	xorl	%eax, %eax
LBB0_24:
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_18, LBB0_18-LJTI0_0
.set L0_0_set_17, LBB0_17-LJTI0_0
.set L0_0_set_19, LBB0_19-LJTI0_0
.set L0_0_set_20, LBB0_20-LJTI0_0
LJTI0_0:
	.long	L0_0_set_18
	.long	L0_0_set_17
	.long	L0_0_set_19
	.long	L0_0_set_20
	.end_data_region
                                        ## -- End function
	.comm	_NUM_G,4,2                      ## @NUM_G
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_voice_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function voice_alloc
_voice_alloc:                           ; @voice_alloc
	.cfi_startproc
; %bb.0:
	str	xzr, [x3]
Lloh0:
	adrp	x8, _NUM_G@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NUM_G@GOTPAGEOFF]
	ldr	w10, [x8]
	cmp	w10, #1
	b.lt	LBB0_11
; %bb.1:
	mov	w11, #0
	ldr	w9, [x0]
	mov	w12, #20
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	sdiv	w13, w9, w10
	msub	w9, w13, w10, w9
	cmp	w2, #2
	b.ne	LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	tbz	w9, #0, LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w9, w9, #1
LBB0_5:                                 ;   in Loop: Header=BB0_2 Depth=1
	add	w9, w9, w2
	add	w11, w11, w2
	cmp	w11, w10
	b.lt	LBB0_2
	b	LBB0_11
LBB0_6:                                 ;   in Loop: Header=BB0_2 Depth=1
	cmp	w2, #1
	b.lt	LBB0_21
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w13, #0
	ldr	x14, [x0, #8]
LBB0_8:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	w15, w9, w13
	sdiv	w16, w15, w10
	msub	w15, w16, w10, w15
	smull	x15, w15, w12
	ldr	w15, [x14, x15]
	cbnz	w15, LBB0_5
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	add	w13, w13, #1
	cmp	w2, w13
	b.ne	LBB0_8
; %bb.10:
	add	w11, w9, w2
	sdiv	w12, w11, w10
	msub	w10, w12, w10, w11
	str	w10, [x0]
	cmp	w9, w10
	b.ne	LBB0_12
LBB0_11:
Lloh2:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	ret
LBB0_12:
	ldr	x10, [x0, #8]
	mov	w11, #20
	mov	w12, #1
	sub	w13, w1, #128
	mov	x14, x9
Lloh5:
	adrp	x15, lJTI0_0@PAGE
Lloh6:
	add	x15, x15, lJTI0_0@PAGEOFF
	b	LBB0_16
LBB0_13:                                ;   in Loop: Header=BB0_16 Depth=1
	madd	x16, x16, x11, x10
	add	x16, x16, #16
LBB0_14:                                ;   in Loop: Header=BB0_16 Depth=1
	str	w12, [x16]
LBB0_15:                                ;   in Loop: Header=BB0_16 Depth=1
	add	w14, w14, #1
	subs	w2, w2, #1
	b.eq	LBB0_23
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	w16, [x8]
	sdiv	w17, w14, w16
	msub	w16, w17, w16, w14
	smull	x17, w16, w11
	str	w12, [x10, x17]
	cmp	w13, #3
	b.hi	LBB0_15
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	sxtw	x16, w16
	adr	x17, LBB0_13
	ldrb	w0, [x15, x13]
	add	x17, x17, x0, lsl #2
	br	x17
LBB0_18:                                ;   in Loop: Header=BB0_16 Depth=1
	madd	x16, x16, x11, x10
	add	x16, x16, #8
	b	LBB0_14
LBB0_19:                                ;   in Loop: Header=BB0_16 Depth=1
	madd	x16, x16, x11, x10
	add	x16, x16, #4
	b	LBB0_14
LBB0_20:                                ;   in Loop: Header=BB0_16 Depth=1
	madd	x16, x16, x11, x10
	add	x16, x16, #12
	b	LBB0_14
LBB0_21:
	add	w8, w9, w2
	sdiv	w11, w8, w10
	msub	w8, w11, w10, w8
	str	w8, [x0]
	cmp	w9, w8
	b.eq	LBB0_11
; %bb.22:
	ldr	x10, [x0, #8]
LBB0_23:
	mov	w0, #0
	mov	w8, #20
	smaddl	x8, w9, w8, x10
	str	x8, [x3]
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_18-LBB0_13)>>2
	.byte	(LBB0_19-LBB0_13)>>2
	.byte	(LBB0_20-LBB0_13)>>2
	.byte	(LBB0_13-LBB0_13)>>2
                                        ; -- End function
	.comm	_NUM_G,4,2                      ; @NUM_G
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_voice_alloc
.subsections_via_symbols
