// File: /workspace/github_c_makefile_star2_O1/waywardgeek[P]sonic/sonic.c
// Function: processStreamInput
static int processStreamInput(sonicStream stream) {
  int originalNumOutputSamples = stream->numOutputSamples;
  float rate = stream->rate * stream->pitch;
  float localSpeed;

  if (stream->numInputSamples == 0) {
    return 1;
  }
  localSpeed =
      stream->numInputSamples * stream->samplePeriod / stream->inputPlayTime;
  if (localSpeed > 1.00001 || localSpeed < 0.99999) {
    changeSpeed(stream, localSpeed);
  } else {
    if (!copyInputToOutput(stream, stream->numInputSamples)) {
      return 0;
    }
  }
  if (rate != 1.0f) {
    if (!adjustRate(stream, rate, originalNumOutputSamples)) {
      return 0;
    }
  }
  if (stream->volume != 1.0f) {
    /* Adjust output volume. */
    scaleSamples(
        stream->outputBuffer + originalNumOutputSamples * stream->numChannels,
        (stream->numOutputSamples - originalNumOutputSamples) *
            stream->numChannels,
        stream->volume);
  }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movslq 0x60(%rdi), %r13
movl $0x1, %eax
testq %r13, %r13
je 0x24c2
movq %rdi, %r14
movss 0x34(%rdi), %xmm3
mulss 0x30(%rdi), %xmm3
movl 0x64(%rdi), %ebx
cvtsi2ss %r13d, %xmm4
mulss 0x38(%rdi), %xmm4
divss 0x3c(%rdi), %xmm4
cvtss2sd %xmm4, %xmm2
ucomisd 0x2538(%rip), %xmm2     # 0x4038
movq %rdi, 0x8(%rsp)
movss %xmm3, 0x20(%rsp)
ja 0x1b63
movsd 0x252b(%rip), %xmm0     # 0x4040
ucomisd %xmm2, %xmm0
ja 0x1b63
movq %r14, %rdi
movl %r13d, %esi
callq 0x27f6
testl %eax, %eax
je 0x24b9
movl %ebx, 0x14(%rsp)
movslq 0x64(%r14), %rdi
movslq 0x50(%r14), %rax
imulq %rax, %rdi
addq %rdi, %rdi
addq 0x8(%r14), %rdi
movq (%r14), %rsi
movq %r13, %rdx
imulq %rax, %rdx
addq %rdx, %rdx
callq 0x10e0
addl %r13d, 0x64(%r14)
movl %r13d, %r15d
jmp 0x212f
movl %ebx, 0x14(%rsp)
movl 0x74(%r14), %ecx
movq %rcx, 0x50(%rsp)
cmpl %ecx, %r13d
jl 0x2140
movss 0x2497(%rip), %xmm0     # 0x4018
movaps %xmm4, %xmm1
cmpltps %xmm0, %xmm1
movss 0x248c(%rip), %xmm3     # 0x401c
movaps %xmm3, %xmm0
cmpltps %xmm4, %xmm0
andps %xmm1, %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x246c(%rip), %xmm0     # 0x4014
cmpltps %xmm4, %xmm0
movaps %xmm4, %xmm1
cmpltps %xmm3, %xmm1
andps %xmm0, %xmm1
movss %xmm1, 0x28(%rsp)
subss %xmm4, %xmm3
movaps %xmm3, 0x80(%rsp)
movss 0x2450(%rip), %xmm0     # 0x4020
addss %xmm4, %xmm0
movss %xmm0, 0x60(%rsp)
movsd 0x2466(%rip), %xmm0     # 0x4048
addsd %xmm2, %xmm0
movsd %xmm0, 0x48(%rsp)
xorl %ebx, %ebx
movaps %xmm4, 0x30(%rsp)
movsd %xmm2, 0x70(%rsp)
movq %r13, 0x78(%rsp)
movl 0x50(%r14), %r12d
movl %r12d, %eax
imull %ebx, %eax
movslq %eax, %rbp
addq %rbp, %rbp
addq (%r14), %rbp
testb $0x1, 0x10(%rsp)
je 0x1c23
xorpd %xmm0, %xmm0
ucomiss 0x40(%r14), %xmm0
ja 0x1c41
testb $0x1, 0x28(%rsp)
je 0x1d12
movss 0x40(%r14), %xmm0
ucomiss 0x23ed(%rip), %xmm0     # 0x4028
jbe 0x1d12
movl 0x60(%r14), %eax
movss 0x40(%r14), %xmm0
mulss %xmm4, %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x38(%r14), %xmm1
mulsd 0x48(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd 0x23c2(%rip), %xmm1     # 0x4030
subsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
subl %ebx, %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
ucomiss %xmm1, %xmm0
cvttss2si %xmm0, %r15d
cmoval %eax, %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x27f6
movss 0x20(%rsp), %xmm3
testl %eax, %eax
je 0x2140
movslq 0x64(%r14), %rdi
movslq 0x50(%r14), %rax
imulq %rax, %rdi
addq %rdi, %rdi
addq 0x8(%r14), %rdi
movslq %r15d, %rdx
imulq %rax, %rdx
addq %rdx, %rdx
movq %rbp, %rsi
callq 0x10e0
movaps 0x30(%rsp), %xmm4
addl %r15d, 0x64(%r14)
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
mulss 0x38(%r14), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x48(%rsp), %xmm0
divsd 0x70(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x40(%r14), %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x40(%r14)
jmp 0x2118
movl 0x7c(%r14), %eax
movl $0x1, %r15d
cmpl $0xfa1, %eax            # imm = 0xFA1
movq %rbx, 0x58(%rsp)
jl 0x1d3c
cmpl $0x0, 0x4c(%r14)
jne 0x1d3c
movl %eax, %eax
imulq $0x10624dd3, %rax, %r15 # imm = 0x10624DD3
shrq $0x28, %r15
movl 0x6c(%r14), %r13d
movl 0x70(%r14), %r11d
movl %r12d, %eax
xorl $0x1, %eax
movl %r15d, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
jne 0x1d62
movq %rbp, %rdi
movl %r13d, %esi
movl %r11d, %edx
jmp 0x1e58
movl 0x74(%r14), %eax
movl %eax, 0x64(%rsp)
cltd
idivl %r15d
testl %eax, %eax
jle 0x1dae
movl %eax, %ecx
movl %r15d, %esi
imull %r12d, %esi
movq 0x18(%r14), %rdi
xorl %r8d, %r8d
movq %rbp, %r9
xorl %eax, %eax
testl %esi, %esi
jle 0x1d9c
movl %esi, %edx
movswl (%r9), %r10d
addq $0x2, %r9
addl %r10d, %eax
decl %edx
jne 0x1d8d
cltd
idivl %esi
movw %ax, (%rdi)
addq $0x2, %rdi
incl %r8d
cmpl %ecx, %r8d
jne 0x1d85
movq 0x18(%r14), %rdi
movl %r13d, %eax
cltd
idivl %r15d
movl %eax, %esi
movl %r11d, %eax
cltd
idivl %r15d
movq %rdi, 0x68(%rsp)
movl %eax, %edx
leaq 0x1c(%rsp), %rcx
leaq 0x18(%rsp), %r8
movl %r11d, %ebx
callq 0x2836
cmpl $0x1, %r15d
je 0x1e67
imull %r15d, %eax
leal (,%r15,4), %ecx
movl %eax, %esi
subl %ecx, %esi
leal (%rax,%r15,4), %eax
cmpl %r13d, %esi
cmovlel %r13d, %esi
cmpl %ebx, %eax
cmovll %eax, %ebx
cmpl $0x1, %r12d
movl %ebx, %r10d
jne 0x1e13
movq %rbp, %rdi
jmp 0x1e55
movl 0x64(%rsp), %r11d
testl %r11d, %r11d
movq 0x68(%rsp), %rdi
jle 0x1e55
xorl %ecx, %ecx
movq %rdi, %rbx
movq %rbp, %r8
xorl %eax, %eax
testl %r12d, %r12d
jle 0x1e43
movl %r12d, %edx
movswl (%r8), %r9d
addq $0x2, %r8
addl %r9d, %eax
decl %edx
jne 0x1e34
cltd
idivl %r12d
movw %ax, (%rbx)
addq $0x2, %rbx
incl %ecx
cmpl %r11d, %ecx
jne 0x1e2a
movl %r10d, %edx
leaq 0x1c(%rsp), %rcx
leaq 0x18(%rsp), %r8
callq 0x2836
movl 0x1c(%rsp), %ecx
movl %eax, %ebx
testl %ecx, %ecx
je 0x1e9d
movl 0x80(%r14), %edx
movl %eax, %ebx
testl %edx, %edx
je 0x1e9d
leal (%rcx,%rcx,2), %esi
movl %eax, %ebx
cmpl 0x18(%rsp), %esi
jl 0x1e9d
leal (%rcx,%rcx), %esi
movl 0x84(%r14), %edi
leal (%rdi,%rdi,2), %edi
cmpl %edi, %esi
cmovlel %eax, %edx
movl %edx, %ebx
movaps 0x30(%rsp), %xmm1
movss 0x2172(%rip), %xmm0     # 0x401c
ucomiss %xmm0, %xmm1
movl %ecx, 0x84(%r14)
movl %eax, 0x80(%r14)
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
jbe 0x1f89
ucomiss 0x2149(%rip), %xmm1     # 0x4018
divss 0x60(%rsp), %xmm0
cvttss2si %xmm0, %r13
cmovbl %ebx, %r13d
movq %r14, %rdi
movl %r13d, %esi
callq 0x27f6
testl %eax, %eax
je 0x2082
movl 0x64(%r14), %ecx
testl %r12d, %r12d
movss 0x20(%rsp), %xmm3
movaps 0x30(%rsp), %xmm4
jle 0x1f78
movl %ecx, %eax
imull %r12d, %eax
movslq %eax, %rsi
addq %rsi, %rsi
movq 0x8(%rsp), %rax
addq 0x8(%rax), %rsi
movl %r12d, %eax
imull %ebx, %eax
movslq %eax, %rdi
leaq (%r12,%r12), %r8
addq %rdi, %rdi
xorl %r9d, %r9d
testl %r13d, %r13d
jle 0x1f68
leaq (%rdi,%rbp), %r10
xorl %r11d, %r11d
movl %r13d, %r14d
xorl %r15d, %r15d
movswl (%rbp,%r11), %edx
imull %r14d, %edx
movswl (%r10,%r11), %eax
imull %r15d, %eax
addl %edx, %eax
cltd
idivl %r13d
movw %ax, (%rsi,%r11)
incl %r15d
addq %r8, %r11
decl %r14d
jne 0x1f3f
incq %r9
addq $0x2, %rbp
addq $0x2, %rsi
cmpq %r12, %r9
jne 0x1f2d
addl %r13d, %ecx
movq 0x8(%rsp), %r14
movl %ecx, 0x64(%r14)
jmp 0x2090
movss 0x2083(%rip), %xmm2     # 0x4014
ucomiss %xmm1, %xmm2
mulss %xmm1, %xmm0
divss 0x80(%rsp), %xmm0
cvttss2si %xmm0, %r15
cmovbl %ebx, %r15d
leal (%r15,%rbx), %r13d
movq %r14, %rdi
movl %r13d, %esi
callq 0x27f6
testl %eax, %eax
je 0x20a8
movslq %r12d, %rax
movslq %ebx, %rdx
movslq 0x64(%r14), %rdi
imulq %rax, %rdi
addq %rdi, %rdi
addq 0x8(%r14), %rdi
imulq %rax, %rdx
addq %rdx, %rdx
movq %rbp, %rsi
callq 0x10e0
movl 0x64(%r14), %ecx
testl %r12d, %r12d
movss 0x20(%rsp), %xmm3
movaps 0x30(%rsp), %xmm4
jle 0x2074
leal (%rcx,%rbx), %eax
imull %r12d, %eax
movslq %eax, %rsi
addq %rsi, %rsi
movq 0x8(%rsp), %rax
addq 0x8(%rax), %rsi
movl %r12d, %eax
imull %ebx, %eax
cltq
leaq (,%rax,2), %rdi
addq %rbp, %rdi
leaq (%r12,%r12), %r8
xorl %r9d, %r9d
testl %r15d, %r15d
jle 0x2060
xorl %r10d, %r10d
movl %r15d, %r11d
xorl %r14d, %r14d
movswl (%rdi,%r10), %edx
imull %r11d, %edx
movswl (%rbp,%r10), %eax
imull %r14d, %eax
addl %edx, %eax
cltd
idivl %r15d
movw %ax, (%rsi,%r10)
incl %r14d
addq %r8, %r10
decl %r11d
jne 0x2037
incq %r9
addq $0x2, %rdi
addq $0x2, %rbp
addq $0x2, %rsi
cmpq %r12, %r9
jne 0x2029
addl %r13d, %ecx
movq 0x8(%rsp), %r14
movl %ecx, 0x64(%r14)
jmp 0x20b6
xorl %r13d, %r13d
movss 0x20(%rsp), %xmm3
movaps 0x30(%rsp), %xmm4
addl %r13d, %ebx
movss 0x1f7d(%rip), %xmm0     # 0x4018
ucomiss %xmm4, %xmm0
movl %ebx, %r15d
movl %r13d, %eax
ja 0x20c8
jmp 0x2109
xorl %r15d, %r15d
movss 0x20(%rsp), %xmm3
movaps 0x30(%rsp), %xmm4
ucomiss 0x1f57(%rip), %xmm4     # 0x4014
jbe 0x2106
addl %r15d, %ebx
movl %ebx, %r13d
movl %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2ss %r13d, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %r15d, %xmm1
xorps %xmm2, %xmm2
cvtsi2ssl 0x60(%r14), %xmm2
mulss 0x3c(%r14), %xmm1
divss %xmm2, %xmm1
mulss 0x38(%r14), %xmm0
subss %xmm1, %xmm0
addss 0x40(%r14), %xmm0
movss %xmm0, 0x40(%r14)
movl %eax, %r13d
jmp 0x2109
movl %r15d, %r13d
testl %r13d, %r13d
movq 0x78(%rsp), %r13
movq 0x58(%rsp), %rbx
je 0x2140
addl %ebx, %r15d
movq 0x50(%rsp), %rax
addl %r15d, %eax
movl %r15d, %ebx
cmpl %r13d, %eax
jle 0x1bfe
movq %r14, %rdi
movl %r15d, %esi
callq 0x27a3
movss 0x20(%rsp), %xmm3
ucomiss 0x1ed5(%rip), %xmm3     # 0x401c
jne 0x214f
jnp 0x2432
movq 0x8(%rsp), %rsi
movl 0x7c(%rsi), %edi
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
divss %xmm3, %xmm0
cvttss2si %xmm0, %ebp
cmpl $0x4000, %edi           # imm = 0x4000
jg 0x2176
cmpl $0x4001, %ebp           # imm = 0x4001
jl 0x218d
movl $0x4001, %eax           # imm = 0x4001
sarl %ebp
sarl %edi
cmpl %eax, %ebp
setge %cl
cmpl %eax, %edi
setge %dl
orb %cl, %dl
jne 0x217b
movl 0x64(%rsi), %r14d
subl 0x14(%rsp), %r14d
je 0x2432
movl %edi, 0x10(%rsp)
movq 0x8(%rsp), %rbx
movslq 0x50(%rbx), %r13
movl 0x58(%rbx), %eax
movl 0x68(%rbx), %ecx
addl %r14d, %ecx
cmpl %eax, %ecx
jle 0x21d8
movl %eax, %ecx
sarl %ecx
addl %r14d, %eax
addl %ecx, %eax
movl %eax, 0x58(%rbx)
movq 0x10(%rbx), %rdi
imull %r13d, %eax
addl %eax, %eax
movslq %eax, %rsi
callq 0x1120
movq %rax, 0x10(%rbx)
movslq 0x68(%rbx), %rdi
imulq %r13, %rdi
addq %rdi, %rdi
addq 0x10(%rbx), %rdi
movl %r13d, %eax
movl 0x14(%rsp), %r15d
imull %r15d, %eax
movslq %eax, %rsi
addq %rsi, %rsi
addq 0x8(%rbx), %rsi
movslq %r14d, %rdx
imulq %r13, %rdx
addq %rdx, %rdx
callq 0x10e0
movl %r15d, 0x64(%rbx)
addl 0x68(%rbx), %r14d
movl %r14d, 0x68(%rbx)
xorl %ebx, %ebx
cmpl $0xd, %r14d
jl 0x23fa
leaq 0x1e25(%rip), %r12      # 0x4050
movq $0x0, 0x28(%rsp)
movq 0x8(%rsp), %rbx
movl 0x10(%rsp), %esi
movq %r13, 0x58(%rsp)
movl 0x44(%rbx), %eax
incl %eax
movl %eax, %ecx
imull %ebp, %ecx
movl 0x48(%rbx), %edx
imull %esi, %edx
cmpl %edx, %ecx
jle 0x23c8
movq 0x28(%rsp), %rax
imulq %r13, %rax
addq %rax, %rax
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x27f6
testl %eax, %eax
je 0x24b9
movl 0x64(%rbx), %eax
movl %eax, 0x50(%rsp)
testl %r13d, %r13d
jle 0x2399
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rdi
movl 0x50(%rsp), %eax
imull %r13d, %eax
movslq %eax, %r8
addq %r8, %r8
addq 0x8(%rsi), %r8
movl 0x48(%rsi), %eax
imull 0x10(%rsp), %eax
movl 0x44(%rsi), %ecx
incl %ecx
imull %ebp, %ecx
notl %eax
addl %ecx, %eax
imull $0x32, %eax, %eax
cltd
idivl %ebp
movl %edx, %ecx
addq 0x48(%rsp), %rdi
movl %ebp, %r9d
subl %edx, %r9d
movslq 0x50(%rsi), %r10
movslq %eax, %r11
addq %r10, %r10
leaq (%r12,%r11,2), %rsi
addq %r11, %r11
xorl %r14d, %r14d
movq %r8, 0x30(%rsp)
movl $0x2, %ebx
movq %rdi, 0x20(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movswl -0x2(%rsi,%rbx), %edx
imull %r9d, %edx
leaq (%r11,%rbx), %rax
movswl (%r12,%rax), %eax
imull %ecx, %eax
addl %edx, %eax
addl %eax, %eax
cltd
idivl %ebp
movswl (%rdi), %edx
imull %eax, %edx
leal (%rdx,%r13), %r8d
movl %r8d, %eax
xorl %r13d, %eax
jns 0x2340
movl %r13d, %eax
sarl $0x1f, %eax
orl $0x1, %eax
xorl %r13d, %edx
movl $0x0, %edx
cmovsl %edx, %eax
addl %eax, %r15d
addq $0x64, %rbx
addq %r10, %rdi
movl %r8d, %r13d
cmpq $0x4b2, %rbx            # imm = 0x4B2
jne 0x22fb
movw $0x7fff, %dx            # imm = 0x7FFF
testl %r15d, %r15d
movq 0x58(%rsp), %r13
movq 0x20(%rsp), %rdi
movq 0x30(%rsp), %rax
jg 0x237f
js 0x2376
shrl $0x10, %r8d
movl %r8d, %edx
jmp 0x237a
movw $0x8000, %dx            # imm = 0x8000
movq 0x30(%rsp), %rax
movw %dx, (%rax)
addq $0x2, %rax
addq $0x2, %rdi
incl %r14d
cmpl %r13d, %r14d
movq %rax, %r8
jne 0x22e6
movq 0x8(%rsp), %rbx
movl 0x44(%rbx), %eax
movl 0x48(%rbx), %ecx
incl %ecx
movl %ecx, 0x48(%rbx)
movl 0x50(%rsp), %edx
incl %edx
movl %edx, 0x64(%rbx)
incl %eax
movl %eax, %edx
imull %ebp, %edx
movl 0x10(%rsp), %esi
imull %esi, %ecx
cmpl %ecx, %edx
jg 0x226b
movl %eax, 0x44(%rbx)
cmpl %esi, %eax
jne 0x23d7
movq $0x0, 0x44(%rbx)
movq 0x28(%rsp), %rdx
incq %rdx
movslq 0x68(%rbx), %r14
leaq -0xc(%r14), %rax
movq %rdx, 0x28(%rsp)
cmpq %rax, %rdx
jl 0x2242
movq 0x28(%rsp), %rbx
testl %ebx, %ebx
je 0x2432
subl %ebx, %r14d
je 0x242a
movq 0x8(%rsp), %rcx
movslq 0x50(%rcx), %rax
movq 0x10(%rcx), %rdi
movslq %ebx, %rcx
imulq %rax, %rcx
leaq (%rdi,%rcx,2), %rsi
movslq %r14d, %rdx
imulq %rax, %rdx
addq %rdx, %rdx
callq 0x1130
movq 0x8(%rsp), %rax
subl %ebx, 0x68(%rax)
movq 0x8(%rsp), %rsi
movss 0x2c(%rsi), %xmm0
ucomiss 0x1bd9(%rip), %xmm0     # 0x401c
jne 0x2447
jnp 0x24bd
movl 0x50(%rsi), %ecx
movl 0x64(%rsi), %edx
movl 0x14(%rsp), %edi
subl %edi, %edx
imull %ecx, %edx
testl %edx, %edx
movl $0x1, %eax
je 0x24c2
mulss 0x1bbd(%rip), %xmm0     # 0x4024
cvttss2si %xmm0, %r10d
imull %edi, %ecx
movslq %ecx, %rcx
addq %rcx, %rcx
addq 0x8(%rsi), %rcx
movl %edx, %edx
xorl %esi, %esi
movl $0xffff8001, %edi       # imm = 0xFFFF8001
movl $0x7fff, %r9d           # imm = 0x7FFF
movswl (%rcx,%rsi,2), %r8d
imull %r10d, %r8d
sarl $0x8, %r8d
cmpl $0xffff8002, %r8d       # imm = 0xFFFF8002
cmovll %edi, %r8d
cmpl %r9d, %r8d
jl 0x24ab
movl $0x7fff, %r8d           # imm = 0x7FFF
movw %r8w, (%rcx,%rsi,2)
incq %rsi
cmpl %esi, %edx
jne 0x2488
jmp 0x24c2
xorl %eax, %eax
jmp 0x24c2
movl $0x1, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq