	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function setup_voice
_setup_voice:                           ## @setup_voice
	.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, %rbx
	movq	48(%rdi), %rax
	movups	(%rax), %xmm0
	movups	%xmm0, 24(%rdi)
	movq	16(%rax), %rax
	movq	%rax, 40(%rdi)
	movq	$-1, (%rdi)
	movl	$-1, 8(%rdi)
	callq	_calc_volume
	movq	%rbx, %rdi
	callq	_calc_pitch
	movq	%rbx, %rdi
	callq	_calc_pan
	movl	24(%rbx), %edi
	callq	_LO_BYTE
	cmpl	$128, %eax
	jl	LBB0_3
## %bb.1:
	cmpl	$32768, 28(%rbx)                ## imm = 0x8000
	jl	LBB0_3
## %bb.2:
	movl	$49151, 28(%rbx)                ## imm = 0xBFFF
	movl	32(%rbx), %edi
	callq	_HI_BYTE
	shll	$4, %eax
	addl	8(%rbx), %eax
	cmpl	$65535, %eax                    ## imm = 0xFFFF
	movl	$65535, %r15d                   ## imm = 0xFFFF
	cmovll	%eax, %r15d
	movl	32(%rbx), %edi
	movl	36(%rbx), %r14d
	callq	_LO_BYTE
	addl	%eax, %r14d
	movl	%r14d, 12(%rbx)
	movl	%r14d, %edi
	xorl	%esi, %esi
	movl	$255, %edx
	callq	_LIMITVALUE
	shll	$8, 12(%rbx)
	jmp	LBB0_4
LBB0_3:
	movl	8(%rbx), %r15d
	movl	36(%rbx), %eax
	shll	$8, %eax
	movl	%eax, 12(%rbx)
LBB0_4:
	leaq	24(%rbx), %r14
	cmpl	$65535, %r15d                   ## imm = 0xFFFF
	jne	LBB0_5
## %bb.12:
	movl	$65535, 16(%rbx)                ## imm = 0xFFFF
	jmp	LBB0_13
LBB0_5:
	movl	%r15d, %ecx
	sarl	$12, %ecx
	movl	$1, %eax
	shll	%cl, %eax
	testl	$2048, %r15d                    ## imm = 0x800
	jne	LBB0_6
## %bb.7:
	testl	$1024, %r15d                    ## imm = 0x400
	jne	LBB0_8
LBB0_9:
	testl	$512, %r15d                     ## imm = 0x200
	je	LBB0_11
LBB0_10:
	imull	$905, %eax, %ecx                ## imm = 0x389
	movslq	%ecx, %rcx
	imulq	$1759218605, %rcx, %rcx         ## imm = 0x68DB8BAD
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rcx
	addl	%edx, %ecx
	addl	%eax, %ecx
	movl	%ecx, %eax
LBB0_11:
	movl	%eax, %ecx
	sarl	%ecx
	addl	%eax, %ecx
	cmpl	$65535, %ecx                    ## imm = 0xFFFF
	movl	$65535, %eax                    ## imm = 0xFFFF
	cmovll	%ecx, %eax
	movl	%eax, 16(%rbx)
LBB0_13:
	movl	(%r14), %edi
	callq	_LO_BYTE
	cmpl	$128, %eax
	jl	LBB0_15
## %bb.14:
	movb	$127, (%r14)
LBB0_15:
	movl	$0, 20(%rbx)
	movl	40(%rbx), %edi
	callq	_LO_BYTE
	cmpl	$128, %eax
	jl	LBB0_17
## %bb.16:
	movb	$127, 40(%rbx)
LBB0_17:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	$4142, %edx                     ## imm = 0x102E
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edx
	movslq	%edx, %rcx
	imulq	$1759218605, %rcx, %rcx         ## imm = 0x68DB8BAD
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rcx
	addl	%edx, %ecx
	addl	%eax, %ecx
	movl	%ecx, %eax
	testl	$1024, %r15d                    ## imm = 0x400
	je	LBB0_9
LBB0_8:
	imull	$1892, %eax, %ecx               ## imm = 0x764
	movslq	%ecx, %rcx
	imulq	$1759218605, %rcx, %rcx         ## imm = 0x68DB8BAD
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$44, %rcx
	addl	%edx, %ecx
	addl	%eax, %ecx
	movl	%ecx, %eax
	testl	$512, %r15d                     ## imm = 0x200
	jne	LBB0_10
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_voltarget,8,3                  ## @voltarget
	.no_dead_strip	_setup_voice
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function setup_voice
_setup_voice:                           ; @setup_voice
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	ldr	x8, [x0, #48]
	ldr	x9, [x8, #16]
	ldr	q0, [x8]
	stur	q0, [x0, #24]
	str	x9, [x0, #40]
	movi.2d	v0, #0xffffffffffffffff
	str	d0, [x0]
	mov	w8, #-1
	str	w8, [x0, #8]
	bl	_calc_volume
	mov	x0, x19
	bl	_calc_pitch
	mov	x0, x19
	bl	_calc_pan
	ldr	w0, [x19, #24]
	bl	_LO_BYTE
	cmp	w0, #128
	b.lt	LBB0_3
; %bb.1:
	ldr	w8, [x19, #28]
	cmp	w8, #8, lsl #12                 ; =32768
	b.lt	LBB0_3
; %bb.2:
	mov	w8, #49151
	str	w8, [x19, #28]
	ldr	w0, [x19, #32]
	bl	_HI_BYTE
	ldr	w8, [x19, #8]
	add	w8, w8, w0, lsl #4
	mov	w9, #65535
	cmp	w8, w9
	csel	w21, w8, w9, lt
	ldp	w0, w20, [x19, #32]
	bl	_LO_BYTE
	add	w0, w0, w20
	str	w0, [x19, #12]
	mov	w1, #0
	mov	w2, #255
	bl	_LIMITVALUE
	ldr	w8, [x19, #12]
	lsl	w8, w8, #8
	str	w8, [x19, #12]
	b	LBB0_4
LBB0_3:
	ldr	w8, [x19, #36]
	lsl	w8, w8, #8
	str	w8, [x19, #12]
	ldr	w21, [x19, #8]
LBB0_4:
	add	x20, x19, #24
	mov	w8, #65535
	cmp	w21, w8
	b.eq	LBB0_10
; %bb.5:
	asr	w8, w21, #12
	mov	w9, #1
	lsl	w10, w9, w8
	mov	w9, #4142
	lsl	w8, w9, w8
	mov	w9, #35757
	movk	w9, #26843, lsl #16
	smull	x8, w8, w9
	lsr	x11, x8, #63
	asr	x8, x8, #44
	add	w8, w8, w11
	add	w8, w8, w10
	tst	w21, #0x800
	csel	w8, w10, w8, eq
	tbz	w21, #10, LBB0_7
; %bb.6:
	mov	w10, #1892
	mul	w10, w8, w10
	smull	x9, w10, w9
	lsr	x10, x9, #63
	asr	x9, x9, #44
	add	w9, w9, w10
	add	w8, w9, w8
LBB0_7:
	tbz	w21, #9, LBB0_9
; %bb.8:
	mov	w9, #905
	mul	w9, w8, w9
	mov	w10, #35757
	movk	w10, #26843, lsl #16
	smull	x9, w9, w10
	lsr	x10, x9, #63
	asr	x9, x9, #44
	add	w9, w9, w10
	add	w8, w9, w8
LBB0_9:
	add	w8, w8, w8, asr #1
	mov	w9, #65535
	cmp	w8, w9
	csel	w8, w8, w9, lt
LBB0_10:
	str	w8, [x19, #16]
	ldr	w0, [x20]
	bl	_LO_BYTE
	cmp	w0, #128
	b.lt	LBB0_12
; %bb.11:
	mov	w8, #127
	strb	w8, [x20]
LBB0_12:
	str	wzr, [x19, #20]
	ldr	w0, [x19, #40]
	bl	_LO_BYTE
	cmp	w0, #128
	b.lt	LBB0_14
; %bb.13:
	mov	w8, #127
	strb	w8, [x19, #40]
LBB0_14:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.comm	_voltarget,8,3                  ; @voltarget
	.no_dead_strip	_setup_voice
.subsections_via_symbols
