	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calc_volume
_calc_volume:                           ## @calc_volume
	.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
	movq	%rdi, %r12
	movq	48(%rdi), %rbx
	movq	40(%rdi), %r15
	movq	(%rbx), %rax
	movq	_MIDI_CTL_MSB_EXPRESSION@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %r14d
	movl	(%rdi), %edi
	movl	$127, %esi
	callq	_LIMITMAX
	movl	%r14d, %edi
	xorl	%esi, %esi
	movl	$127, %edx
	callq	_LIMITVALUE
	movq	(%r15), %rcx
	movq	_SNDRV_EMUX_PORT_MODE_OSS_SYNTH@GOTPCREL(%rip), %rdx
	movq	(%rbx), %rax
	movq	_MIDI_CTL_MSB_MAIN_VOLUME@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	movl	(%rax,%rsi,4), %eax
	cmpq	(%rdx), %rcx
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	jne	LBB0_2
## %bb.1:
	imull	%r14d, %eax
	imull	(%r12), %eax
	cltq
	imulq	$-2113531863, %rax, %rcx        ## imm = 0x82061029
	shrq	$32, %rcx
	addl	%ecx, %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	sarl	$13, %eax
	addl	%ecx, %eax
	imull	16(%r12), %eax
	movslq	%eax, %rbx
	imulq	$-2130574327, %rbx, %rax        ## imm = 0x81020409
	shrq	$32, %rax
	addl	%eax, %ebx
	movl	%ebx, %eax
	shrl	$31, %eax
	sarl	$6, %ebx
	addl	%eax, %ebx
	movl	%ebx, %edi
	xorl	%esi, %esi
	movl	$127, %edx
	callq	_LIMITVALUE
	movq	_snd_sf_vol_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %rcx
	movl	(%rax,%rcx,4), %ebx
	jmp	LBB0_3
LBB0_2:
	imull	16(%r12), %eax
	movslq	%r14d, %r14
	movslq	%eax, %rbx
	imulq	$-2130574327, %rbx, %rax        ## imm = 0x81020409
	shrq	$32, %rax
	addl	%eax, %ebx
	movl	%ebx, %eax
	shrl	$31, %eax
	sarl	$6, %ebx
	addl	%eax, %ebx
	movl	%ebx, %edi
	xorl	%esi, %esi
	movl	$127, %edx
	callq	_LIMITVALUE
	movq	_voltab1@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %rcx
	movq	_voltab2@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movslq	(%r12), %rsi
	movl	(%rdx,%rsi,4), %edx
	addl	(%rax,%rcx,4), %edx
	shll	$3, %edx
	movslq	%edx, %rax
	imulq	$1431655766, %rax, %rax         ## imm = 0x55555556
	movq	%rax, %rcx
	shrq	$63, %rcx
	shrq	$32, %rax
	addl	%ecx, %eax
	addl	32(%r12), %eax
	movl	$256, %ecx                      ## imm = 0x100
	subl	%eax, %ecx
	movq	_expressiontab@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	imull	(%rdx,%r14,4), %ecx
	leal	127(%rcx), %ebx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %ebx
	sarl	$7, %ebx
	addl	%eax, %ebx
LBB0_3:
	movslq	16(%r15), %r14
	xorl	%r13d, %r13d
	movl	%r14d, %edi
	xorl	%esi, %esi
	movl	$127, %edx
	callq	_LIMITVALUE
	movq	_snd_sf_vol_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	addl	(%rax,%r14,4), %ebx
	addl	8(%r15), %ebx
	movl	%ebx, %edi
	xorl	%esi, %esi
	movl	$255, %edx
	callq	_LIMITVALUE
	cmpl	%ebx, 4(%r12)
	je	LBB0_9
## %bb.4:
	movl	%ebx, 4(%r12)
	movq	%r15, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_get_bank
	movl	%eax, %edi
	callq	_SF_IS_DRUM_BANK
	testl	%eax, %eax
	jne	LBB0_7
## %bb.5:
	movl	24(%r12), %edi
	callq	_LO_BYTE
	cmpl	$124, %eax
	jg	LBB0_7
## %bb.6:
	movl	(%r12), %ecx
	cmpl	$71, %ecx
	movl	$70, %eax
	cmovgel	%ecx, %eax
	imull	20(%r12), %eax
	addl	$160, %eax
	sarl	$7, %eax
	jmp	LBB0_8
LBB0_7:
	movl	20(%r12), %eax
LBB0_8:
	movl	%eax, 8(%r12)
	movl	$1, %r13d
LBB0_9:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MIDI_CTL_MSB_EXPRESSION,8,3    ## @MIDI_CTL_MSB_EXPRESSION
	.comm	_SNDRV_EMUX_PORT_MODE_OSS_SYNTH,8,3 ## @SNDRV_EMUX_PORT_MODE_OSS_SYNTH
	.comm	_MIDI_CTL_MSB_MAIN_VOLUME,8,3   ## @MIDI_CTL_MSB_MAIN_VOLUME
	.comm	_snd_sf_vol_table,8,3           ## @snd_sf_vol_table
	.comm	_voltab1,8,3                    ## @voltab1
	.comm	_voltab2,8,3                    ## @voltab2
	.comm	_expressiontab,8,3              ## @expressiontab
	.comm	_EMUX_FX_ATTEN,8,3              ## @EMUX_FX_ATTEN
	.no_dead_strip	_calc_volume
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_volume
_calc_volume:                           ; @calc_volume
	.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	x19, x0
	ldp	x21, x20, [x0, #40]
Lloh0:
	adrp	x8, _MIDI_CTL_MSB_EXPRESSION@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MIDI_CTL_MSB_EXPRESSION@GOTPAGEOFF]
	ldr	x9, [x20]
Lloh2:
	ldr	x8, [x8]
	ldr	w22, [x9, x8, lsl #2]
	sxtw	x24, w22
	ldr	w0, [x0]
	mov	w1, #127
	bl	_LIMITMAX
	mov	x0, x22
	mov	w1, #0
	mov	w2, #127
	bl	_LIMITVALUE
	ldr	x9, [x21]
Lloh3:
	adrp	x8, _SNDRV_EMUX_PORT_MODE_OSS_SYNTH@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SNDRV_EMUX_PORT_MODE_OSS_SYNTH@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x8]
	ldr	x8, [x20]
Lloh6:
	adrp	x11, _MIDI_CTL_MSB_MAIN_VOLUME@GOTPAGE
Lloh7:
	ldr	x11, [x11, _MIDI_CTL_MSB_MAIN_VOLUME@GOTPAGEOFF]
Lloh8:
	ldr	x11, [x11]
	ldr	w8, [x8, x11, lsl #2]
Lloh9:
	adrp	x23, _snd_sf_vol_table@GOTPAGE
Lloh10:
	ldr	x23, [x23, _snd_sf_vol_table@GOTPAGEOFF]
	cmp	x9, x10
	b.ne	LBB0_2
; %bb.1:
	ldr	w9, [x19]
	mul	w8, w8, w24
	mul	w8, w8, w9
	mov	w9, #4137
	movk	w9, #33286, lsl #16
	smull	x9, w8, w9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #13
	add	w8, w9, w8, lsr #31
	ldr	w9, [x19, #16]
	mul	w8, w8, w9
	mov	w9, #1033
	movk	w9, #33026, lsl #16
	smull	x9, w8, w9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #6
	add	w22, w9, w8, lsr #31
	mov	x0, x22
	mov	w1, #0
	mov	w2, #127
	bl	_LIMITVALUE
	ldr	x8, [x23]
	ldr	w24, [x8, w22, sxtw #2]
	b	LBB0_3
LBB0_2:
	ldr	w9, [x19, #16]
	mul	w8, w9, w8
	mov	w9, #1033
	movk	w9, #33026, lsl #16
	smull	x9, w8, w9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #6
	add	w22, w9, w8, lsr #31
	mov	x0, x22
	mov	w1, #0
	mov	w2, #127
	bl	_LIMITVALUE
Lloh11:
	adrp	x8, _voltab1@GOTPAGE
Lloh12:
	ldr	x8, [x8, _voltab1@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	ldr	w8, [x8, w22, sxtw #2]
Lloh14:
	adrp	x9, _voltab2@GOTPAGE
Lloh15:
	ldr	x9, [x9, _voltab2@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	ldrsw	x10, [x19]
	ldr	w9, [x9, x10, lsl #2]
	add	w8, w9, w8
	lsl	w8, w8, #3
	mov	w9, #21846
	movk	w9, #21845, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	lsr	x8, x8, #32
	ldr	w10, [x19, #32]
	add	w8, w8, w9
	add	w8, w8, w10
	mov	w9, #256
Lloh17:
	adrp	x10, _expressiontab@GOTPAGE
Lloh18:
	ldr	x10, [x10, _expressiontab@GOTPAGEOFF]
Lloh19:
	ldr	x10, [x10]
	ldr	w10, [x10, x24, lsl #2]
	sub	w9, w9, w8
	mul	w9, w9, w10
	add	w10, w9, #127
	cmp	w9, #0
	csel	w9, w10, w9, lt
	add	w24, w8, w9, asr #7
LBB0_3:
	ldrsw	x22, [x21, #16]
	mov	x0, x22
	mov	w1, #0
	mov	w2, #127
	bl	_LIMITVALUE
	ldr	x8, [x23]
	ldr	w8, [x8, x22, lsl #2]
	ldr	w9, [x21, #8]
	add	w8, w8, w24
	add	w22, w8, w9
	mov	x0, x22
	mov	w1, #0
	mov	w2, #255
	bl	_LIMITVALUE
	mov	w0, #0
	ldr	w8, [x19, #4]
	cmp	w8, w22
	b.eq	LBB0_9
; %bb.4:
	str	w22, [x19, #4]
	mov	x0, x21
	mov	x1, x20
	bl	_get_bank
	bl	_SF_IS_DRUM_BANK
	cbnz	w0, LBB0_7
; %bb.5:
	ldr	w0, [x19, #24]
	bl	_LO_BYTE
	cmp	w0, #124
	b.gt	LBB0_7
; %bb.6:
	ldr	w8, [x19]
	mov	w9, #70
	cmp	w8, #70
	csel	w8, w8, w9, gt
	ldr	w9, [x19, #20]
	mul	w8, w8, w9
	add	w8, w8, #160
	asr	w8, w8, #7
	b	LBB0_8
LBB0_7:
	ldr	w8, [x19, #20]
LBB0_8:
	str	w8, [x19, #8]
	mov	w0, #1
LBB0_9:
	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
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_MIDI_CTL_MSB_EXPRESSION,8,3    ; @MIDI_CTL_MSB_EXPRESSION
	.comm	_SNDRV_EMUX_PORT_MODE_OSS_SYNTH,8,3 ; @SNDRV_EMUX_PORT_MODE_OSS_SYNTH
	.comm	_MIDI_CTL_MSB_MAIN_VOLUME,8,3   ; @MIDI_CTL_MSB_MAIN_VOLUME
	.comm	_snd_sf_vol_table,8,3           ; @snd_sf_vol_table
	.comm	_voltab1,8,3                    ; @voltab1
	.comm	_voltab2,8,3                    ; @voltab2
	.comm	_expressiontab,8,3              ; @expressiontab
	.comm	_EMUX_FX_ATTEN,8,3              ; @EMUX_FX_ATTEN
	.no_dead_strip	_calc_volume
.subsections_via_symbols
