	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calc_pan
_calc_pan:                              ## @calc_pan
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	16(%rdi), %rax
	testq	%rax, %rax
	jle	LBB0_2
## %bb.1:
	addl	%eax, %eax
	movl	$255, %ebx
	subl	%eax, %ebx
	jmp	LBB0_3
LBB0_2:
	movq	32(%r14), %rax
	movq	(%rax), %rax
	movq	_MIDI_CTL_MSB_PAN@GOTPCREL(%rip), %rcx
	movl	24(%r14), %edx
	movl	$64, %esi
	subl	%edx, %esi
	xorl	%edi, %edi
	testl	%edx, %edx
	cmovnsl	%esi, %edi
	movq	(%rcx), %rcx
	subl	(%rax,%rcx,4), %edi
	leal	(%rdi,%rdi), %ebx
	addl	$255, %ebx
LBB0_3:
	xorl	%r15d, %r15d
	movl	%ebx, %edi
	xorl	%esi, %esi
	movl	$255, %edx
	callq	_LIMITVALUE
	movq	8(%r14), %rax
	cmpq	$0, (%rax)
	movl	(%r14), %ecx
	je	LBB0_6
## %bb.4:
	cmpl	%ecx, %ebx
	je	LBB0_9
## %bb.5:
	movl	%ebx, (%r14)
	negl	%ebx
	movzbl	%bl, %eax
	jmp	LBB0_8
LBB0_6:
	movq	_pan_volumes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %rdx
	movl	(%rax,%rdx,8), %edx
	cmpl	%edx, %ecx
	je	LBB0_9
## %bb.7:
	movl	%edx, (%r14)
	movl	$255, %ecx
	subl	%ebx, %ecx
	movslq	%ecx, %rcx
	movl	(%rax,%rcx,8), %eax
LBB0_8:
	movl	%eax, 4(%r14)
	movl	$1, %r15d
LBB0_9:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MIDI_CTL_MSB_PAN,8,3           ## @MIDI_CTL_MSB_PAN
	.comm	_pan_volumes,8,3                ## @pan_volumes
	.no_dead_strip	_calc_pan
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_pan
_calc_pan:                              ; @calc_pan
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x8, [x0, #16]
	cmp	x8, #1
	b.lt	LBB0_2
; %bb.1:
	mov	w9, #255
	sub	w20, w9, w8, lsl #1
	b	LBB0_3
LBB0_2:
	ldr	x8, [x19, #32]
Lloh0:
	adrp	x9, _MIDI_CTL_MSB_PAN@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MIDI_CTL_MSB_PAN@GOTPAGEOFF]
	ldr	x8, [x8]
Lloh2:
	ldr	x9, [x9]
	ldr	w8, [x8, x9, lsl #2]
	ldr	w9, [x19, #24]
	mov	w10, #64
	sub	w10, w10, w9
	cmp	w9, #0
	csel	w9, wzr, w10, lt
	sub	w8, w9, w8
	lsl	w8, w8, #1
	add	w20, w8, #255
LBB0_3:
	mov	x0, x20
	mov	w1, #0
	mov	w2, #255
	bl	_LIMITVALUE
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	w9, [x19]
	cbz	x8, LBB0_6
; %bb.4:
	cmp	w20, w9
	b.eq	LBB0_7
; %bb.5:
	str	w20, [x19]
	neg	w8, w20
	and	w8, w8, #0xff
	b	LBB0_9
LBB0_6:
Lloh3:
	adrp	x8, _pan_volumes@GOTPAGE
Lloh4:
	ldr	x8, [x8, _pan_volumes@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	ldr	x10, [x8, w20, sxtw #3]
	cmp	w9, w10
	b.ne	LBB0_8
LBB0_7:
	mov	w0, #0
	b	LBB0_10
LBB0_8:
	sxtw	x9, w20
	str	w10, [x19]
	mov	w10, #255
	sub	x9, x10, x9
	ldr	x8, [x8, x9, lsl #3]
LBB0_9:
	str	w8, [x19, #4]
	mov	w0, #1
LBB0_10:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_MIDI_CTL_MSB_PAN,8,3           ; @MIDI_CTL_MSB_PAN
	.comm	_pan_volumes,8,3                ; @pan_volumes
	.no_dead_strip	_calc_pan
.subsections_via_symbols
