	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function opl3_alloc_voice
_opl3_alloc_voice:                      ## @opl3_alloc_voice
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movq	_devc@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	cmpl	$15, %esi
	jbe	LBB0_2
## %bb.1:
	xorl	%eax, %eax
	jmp	LBB0_3
LBB0_2:
	movq	16(%rdx), %rax
	movl	%esi, %esi
	movslq	(%rax,%rsi,4), %rax
LBB0_3:
	movq	8(%rdx), %rsi
	shlq	$4, %rax
	cmpq	$0, (%rsi,%rax)
	movl	(%rdx), %r9d
	js	LBB0_7
## %bb.4:
	cmpl	$12, %r9d
	jne	LBB0_9
## %bb.5:
	movq	8(%rsi,%rax), %rax
	movq	_OPL3_PATCH@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	jne	LBB0_8
## %bb.6:
	movl	$12, %r8d
	xorl	%r11d, %r11d
	movl	$6, %r9d
	jmp	LBB0_10
LBB0_7:
	cmpl	$12, %r9d
	jne	LBB0_9
LBB0_8:
	movl	$6, %r11d
	movl	$12, %r9d
	movl	$12, %r8d
	jmp	LBB0_10
LBB0_9:
	xorl	%r11d, %r11d
	movl	%r9d, %r8d
	testl	%r9d, %r9d
	jle	LBB0_14
LBB0_10:
	movq	(%rcx), %r10
	movl	$2147483647, %esi               ## imm = 0x7FFFFFFF
	movl	%r9d, %edi
	movl	%r11d, %edx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movslq	%edx, %rax
	cmpq	$0, (%r10,%rax,8)
	je	LBB0_15
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	8(%rcx), %rdx
	movl	(%rdx,%rax,4), %edx
	cmpl	%esi, %edx
	cmovll	%eax, %r11d
	cmovll	%edx, %esi
	incl	%eax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%r9d
	decl	%edi
	jne	LBB0_11
## %bb.13:
	movl	%r8d, %r9d
LBB0_14:
	xorl	%eax, %eax
	testl	%r11d, %r11d
	cmovlel	%eax, %r11d
	cmpl	%r9d, %r11d
	cmovgl	%r9d, %eax
	subl	%eax, %r11d
	movl	%r11d, %edx
LBB0_15:
	movl	%edx, %eax
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_devc,8,3                       ## @devc
	.comm	_OPL3_PATCH,8,3                 ## @OPL3_PATCH
	.no_dead_strip	_opl3_alloc_voice
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function opl3_alloc_voice
_opl3_alloc_voice:                      ; @opl3_alloc_voice
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x8, _devc@GOTPAGE
Lloh1:
	ldr	x8, [x8, _devc@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	w1, #15
	b.ls	LBB0_2
; %bb.1:
	mov	x9, #0
	b	LBB0_3
LBB0_2:
	ldr	x9, [x8, #16]
	ldrsw	x9, [x9, w1, uxtw #2]
LBB0_3:
	ldr	x10, [x8, #8]
	lsl	x11, x9, #4
	ldr	x11, [x10, x11]
	ldr	w8, [x8]
	cmp	w8, #12
	tbnz	x11, #63, LBB0_7
; %bb.4:
	b.ne	LBB0_9
; %bb.5:
	add	x8, x10, x9, lsl #4
	ldr	x8, [x8, #8]
Lloh3:
	adrp	x9, _OPL3_PATCH@GOTPAGE
Lloh4:
	ldr	x9, [x9, _OPL3_PATCH@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.6:
	mov	w0, #0
	mov	w9, #12
	mov	w8, #6
	b	LBB0_10
LBB0_7:
	b.ne	LBB0_9
LBB0_8:
	mov	w0, #6
	mov	w8, #12
	mov	w9, #12
	b	LBB0_10
LBB0_9:
	mov	w0, #0
	mov	w10, #0
	mov	x9, x8
	cmp	w8, #1
	b.lt	LBB0_13
LBB0_10:
	ldr	x11, [x3]
	mov	w12, #2147483647
	mov	x13, x8
	mov	x10, x0
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x14, [x11, w0, sxtw #3]
	cbz	x14, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	sxtw	x14, w0
	ldr	x15, [x3, #8]
	ldr	w14, [x15, x14, lsl #2]
	cmp	w14, w12
	csel	w10, w0, w10, lt
	csel	w12, w14, w12, lt
	add	w14, w0, #1
	sdiv	w15, w14, w8
	msub	w0, w15, w8, w14
	subs	w13, w13, #1
	b.ne	LBB0_11
LBB0_13:
	cmp	w10, #0
	csel	w8, w10, wzr, gt
	cmp	w8, w9
	csel	w9, w9, wzr, gt
	sub	w0, w8, w9
LBB0_14:
                                        ; kill: def $w0 killed $w0 killed $x0
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_devc,8,3                       ; @devc
	.comm	_OPL3_PATCH,8,3                 ; @OPL3_PATCH
	.no_dead_strip	_opl3_alloc_voice
.subsections_via_symbols
