// File: /workspace/github_c_makefile_star2_O3/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 $0x88, %rsp
movslq 0x60(%rdi), %r14
movl $0x1, %eax
testq %r14, %r14
je 0x24c4
movq %rdi, %r8
movss 0x34(%rdi), %xmm0
mulss 0x30(%rdi), %xmm0
movss %xmm0, 0x14(%rsp)
movl 0x64(%rdi), %eax
movl %eax, 0x8(%rsp)
cvtsi2ss %r14d, %xmm3
mulss 0x38(%rdi), %xmm3
divss 0x3c(%rdi), %xmm3
cvtss2sd %xmm3, %xmm2
ucomisd 0x1565(%rip), %xmm2     # 0x3068
movq %rdi, (%rsp)
ja 0x1b61
movsd 0x155f(%rip), %xmm0     # 0x3070
ucomisd %xmm2, %xmm0
ja 0x1b61
movq %r8, %rdi
movl %r14d, %esi
movq %r8, %rbx
callq 0x272a
testl %eax, %eax
je 0x24bb
movslq 0x64(%rbx), %rdi
movslq 0x50(%rbx), %rax
imulq %rax, %rdi
addq %rdi, %rdi
addq 0x8(%rbx), %rdi
movq (%rbx), %rsi
movq %r14, %rdx
imulq %rax, %rdx
addq %rdx, %rdx
callq 0x10e0
addl %r14d, 0x64(%rbx)
movl %r14d, %r15d
movq %rbx, %r8
jmp 0x2103
movl 0x74(%r8), %ecx
movq %rcx, 0x58(%rsp)
cmpl %ecx, %r14d
jl 0x2112
movss 0x149d(%rip), %xmm0     # 0x3018
movaps %xmm3, %xmm1
cmpltps %xmm0, %xmm1
movss 0x1492(%rip), %xmm4     # 0x301c
movaps %xmm4, %xmm0
cmpltps %xmm3, %xmm0
andps %xmm1, %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x1472(%rip), %xmm0     # 0x3014
cmpltps %xmm3, %xmm0
movaps %xmm3, %xmm1
cmpltps %xmm4, %xmm1
andps %xmm0, %xmm1
movss %xmm1, 0x18(%rsp)
subss %xmm3, %xmm4
movaps %xmm4, 0x70(%rsp)
movss 0x1459(%rip), %xmm0     # 0x3020
addss %xmm3, %xmm0
movss %xmm0, 0x6c(%rsp)
movsd 0x149f(%rip), %xmm0     # 0x3078
addsd %xmm2, %xmm0
movsd %xmm0, 0x48(%rsp)
xorl %ebx, %ebx
movaps %xmm3, 0x20(%rsp)
movsd %xmm2, 0x50(%rsp)
movq %r14, 0x40(%rsp)
movl 0x50(%r8), %r12d
movl %r12d, %eax
imull %ebx, %eax
movslq %eax, %rbp
addq %rbp, %rbp
addq (%r8), %rbp
testb $0x1, 0x1c(%rsp)
je 0x1c1d
movss 0x40(%r8), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
ja 0x1c3b
testb $0x1, 0x18(%rsp)
je 0x1d08
movss 0x40(%r8), %xmm0
ucomiss 0x13f3(%rip), %xmm0     # 0x3028
jbe 0x1d08
movl 0x60(%r8), %eax
mulss %xmm3, %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x38(%r8), %xmm1
mulsd 0x48(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd 0x13fe(%rip), %xmm1     # 0x3060
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 %r8, %rdi
movl %r15d, %esi
callq 0x272a
movq (%rsp), %r8
testl %eax, %eax
je 0x2112
movslq 0x64(%r8), %rdi
movslq 0x50(%r8), %rax
imulq %rax, %rdi
addq %rdi, %rdi
addq 0x8(%r8), %rdi
movslq %r15d, %rdx
imulq %rax, %rdx
addq %rdx, %rdx
movq %rbp, %rsi
callq 0x10e0
movaps 0x20(%rsp), %xmm3
movq (%rsp), %r8
addl %r15d, 0x64(%r8)
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
mulss 0x38(%r8), %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x48(%rsp), %xmm0
divsd 0x50(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x40(%r8), %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x40(%r8)
jmp 0x20ec
movl 0x7c(%r8), %eax
movl $0x1, %r15d
cmpl $0xfa1, %eax            # imm = 0xFA1
movq %rbx, 0x60(%rsp)
jl 0x1d32
cmpl $0x0, 0x4c(%r8)
jne 0x1d32
movl %eax, %eax
imulq $0x10624dd3, %rax, %r15 # imm = 0x10624DD3
shrq $0x28, %r15
movl 0x6c(%r8), %ebx
movl 0x70(%r8), %r11d
movl %r12d, %eax
xorl $0x1, %eax
movl %r15d, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
jne 0x1d57
movq %rbp, %rdi
movl %ebx, %esi
movl %r11d, %edx
jmp 0x1e40
movl 0x74(%r8), %r13d
movl %r13d, %eax
cltd
idivl %r15d
movq 0x18(%r8), %rdi
testl %eax, %eax
jle 0x1da6
movl %eax, %ecx
movl %r15d, %esi
imull %r12d, %esi
xorl %r14d, %r14d
movq %rdi, %r8
movq %rbp, %r9
xorl %eax, %eax
testl %esi, %esi
jle 0x1d93
movl %esi, %edx
movswl (%r9), %r10d
addq $0x2, %r9
addl %r10d, %eax
decl %edx
jne 0x1d84
cltd
idivl %esi
movw %ax, (%r8)
addq $0x2, %r8
incl %r14d
cmpl %ecx, %r14d
jne 0x1d7c
movl %ebx, %eax
cltd
idivl %r15d
movl %eax, %esi
movl %r11d, %eax
cltd
idivl %r15d
movq %rdi, 0x38(%rsp)
movl %eax, %edx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movl %r11d, %r14d
callq 0x276a
cmpl $0x1, %r15d
je 0x1e4f
imull %r15d, %eax
leal (,%r15,4), %ecx
movl %eax, %esi
subl %ecx, %esi
leal (%rax,%r15,4), %eax
cmpl %ebx, %esi
cmovlel %ebx, %esi
cmpl %r14d, %eax
cmovll %eax, %r14d
cmpl $0x1, %r12d
jne 0x1dff
movq %rbp, %rdi
jmp 0x1e3d
testl %r13d, %r13d
movq 0x38(%rsp), %rdi
jle 0x1e3d
xorl %ecx, %ecx
movq %rdi, %r11
movq %rbp, %r8
xorl %eax, %eax
testl %r12d, %r12d
jle 0x1e2a
movl %r12d, %edx
movswl (%r8), %r9d
addq $0x2, %r8
addl %r9d, %eax
decl %edx
jne 0x1e1b
cltd
idivl %r12d
movw %ax, (%r11)
addq $0x2, %r11
incl %ecx
cmpl %r13d, %ecx
jne 0x1e11
movl %r14d, %edx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
callq 0x276a
movl 0x10(%rsp), %ecx
movl %eax, %r13d
testl %ecx, %ecx
movq (%rsp), %rdi
je 0x1e8e
movl 0x80(%rdi), %edx
movl %eax, %r13d
testl %edx, %edx
je 0x1e8e
leal (%rcx,%rcx,2), %esi
movl %eax, %r13d
cmpl 0xc(%rsp), %esi
jl 0x1e8e
leal (%rcx,%rcx), %esi
movl 0x84(%rdi), %r8d
leal (%r8,%r8,2), %r8d
cmpl %r8d, %esi
cmovlel %eax, %edx
movl %edx, %r13d
movaps 0x20(%rsp), %xmm1
movss 0x1181(%rip), %xmm0     # 0x301c
ucomiss %xmm0, %xmm1
movl %ecx, 0x84(%rdi)
movl %eax, 0x80(%rdi)
xorps %xmm0, %xmm0
cvtsi2ss %r13d, %xmm0
jbe 0x1f6e
ucomiss 0x1159(%rip), %xmm1     # 0x3018
divss 0x6c(%rsp), %xmm0
cvttss2si %xmm0, %rbx
cmovbl %r13d, %ebx
movl %ebx, %esi
movq %rdi, %r14
callq 0x272a
testl %eax, %eax
je 0x205c
movl 0x64(%r14), %ecx
testl %r12d, %r12d
movaps 0x20(%rsp), %xmm3
jle 0x1f5f
movl %ecx, %eax
imull %r12d, %eax
movslq %eax, %rsi
addq %rsi, %rsi
movq (%rsp), %rax
addq 0x8(%rax), %rsi
movl %r12d, %eax
imull %r13d, %eax
movslq %eax, %rdi
leaq (%r12,%r12), %r8
addq %rdi, %rdi
xorl %r9d, %r9d
testl %ebx, %ebx
jle 0x1f4f
leaq (%rdi,%rbp), %r10
xorl %r11d, %r11d
movl %ebx, %r14d
xorl %r15d, %r15d
movswl (%rbp,%r11), %edx
imull %r14d, %edx
movswl (%r10,%r11), %eax
imull %r15d, %eax
addl %edx, %eax
cltd
idivl %ebx
movw %ax, (%rsi,%r11)
incl %r15d
addq %r8, %r11
decl %r14d
jne 0x1f27
incq %r9
addq $0x2, %rbp
addq $0x2, %rsi
cmpq %r12, %r9
jne 0x1f16
addl %ebx, %ecx
movq (%rsp), %r8
movl %ecx, 0x64(%r8)
jmp 0x2066
movss 0x109e(%rip), %xmm2     # 0x3014
ucomiss %xmm1, %xmm2
mulss %xmm1, %xmm0
divss 0x70(%rsp), %xmm0
cvttss2si %xmm0, %r15
cmovbl %r13d, %r15d
leal (%r15,%r13), %ebx
movl %ebx, %esi
movq %rdi, %r14
callq 0x272a
testl %eax, %eax
je 0x2082
movslq %r12d, %rax
movslq %r13d, %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
movaps 0x20(%rsp), %xmm3
jle 0x2050
leal (%rcx,%r13), %eax
imull %r12d, %eax
movslq %eax, %rsi
addq %rsi, %rsi
movq (%rsp), %rax
addq 0x8(%rax), %rsi
movl %r12d, %eax
imull %r13d, %eax
cltq
leaq (,%rax,2), %rdi
addq %rbp, %rdi
leaq (%r12,%r12), %r8
xorl %r9d, %r9d
testl %r15d, %r15d
jle 0x203c
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 0x2013
incq %r9
addq $0x2, %rdi
addq $0x2, %rbp
addq $0x2, %rsi
cmpq %r12, %r9
jne 0x2005
addl %ebx, %ecx
movq (%rsp), %r8
movl %ecx, 0x64(%r8)
jmp 0x208d
xorl %ebx, %ebx
movq %r14, %r8
movaps 0x20(%rsp), %xmm3
addl %ebx, %r13d
movss 0xfa7(%rip), %xmm0      # 0x3018
ucomiss %xmm3, %xmm0
movl %r13d, %r15d
movl %ebx, %eax
movq 0x40(%rsp), %r14
ja 0x20a4
jmp 0x20e3
xorl %r15d, %r15d
movq %r14, %r8
movaps 0x20(%rsp), %xmm3
ucomiss 0xf80(%rip), %xmm3      # 0x3014
movq 0x40(%rsp), %r14
jbe 0x20e0
addl %r15d, %r13d
movl %r13d, %ebx
movl %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %r15d, %xmm1
xorps %xmm2, %xmm2
cvtsi2ssl 0x60(%r8), %xmm2
mulss 0x3c(%r8), %xmm1
divss %xmm2, %xmm1
mulss 0x38(%r8), %xmm0
subss %xmm1, %xmm0
addss 0x40(%r8), %xmm0
movss %xmm0, 0x40(%r8)
movl %eax, %ebx
jmp 0x20e3
movl %r15d, %ebx
testl %ebx, %ebx
movq 0x60(%rsp), %rbx
je 0x2112
addl %ebx, %r15d
movq 0x58(%rsp), %rax
addl %r15d, %eax
movl %r15d, %ebx
cmpl %r14d, %eax
jle 0x1bf5
movq %r8, %rdi
movl %r15d, %esi
callq 0x26d3
movq (%rsp), %r8
movss 0x14(%rsp), %xmm0
ucomiss 0xefd(%rip), %xmm0      # 0x301c
movl 0x8(%rsp), %eax
jne 0x212b
jnp 0x2438
movl 0x7c(%r8), %r15d
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
divss %xmm1, %xmm0
cvttss2si %xmm0, %r14d
cmpl $0x4000, %r15d          # imm = 0x4000
jg 0x2155
cmpl $0x4001, %r14d          # imm = 0x4001
jl 0x2170
movl $0x4001, %eax           # imm = 0x4001
sarl %r14d
sarl %r15d
cmpl %eax, %r14d
setge %cl
cmpl %eax, %r15d
setge %dl
orb %cl, %dl
jne 0x215a
movl 0x64(%r8), %ebx
movl 0x8(%rsp), %eax
subl %eax, %ebx
je 0x2438
movslq 0x50(%r8), %r13
movl 0x58(%r8), %eax
movl 0x68(%r8), %ecx
leal (%rcx,%rbx), %edx
cmpl %eax, %edx
jle 0x21bf
movl %eax, %ecx
sarl %ecx
addl %ebx, %eax
addl %ecx, %eax
movl %eax, 0x58(%r8)
movq 0x10(%r8), %rdi
imull %r13d, %eax
addl %eax, %eax
movslq %eax, %rsi
callq 0x1120
movq (%rsp), %r8
movq %rax, 0x10(%r8)
movl 0x68(%r8), %ecx
jmp 0x21c3
movq 0x10(%r8), %rax
imull %r13d, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,2), %rdi
movl %r13d, %eax
movl 0x8(%rsp), %ebp
imull %ebp, %eax
movslq %eax, %rsi
addq %rsi, %rsi
addq 0x8(%r8), %rsi
movslq %ebx, %rbx
movq %r13, %rdx
imulq %rbx, %rdx
addq %rdx, %rdx
callq 0x10e0
movl %ebp, %eax
movq (%rsp), %r8
movl %ebp, 0x64(%r8)
addl 0x68(%r8), %ebx
movl %ebx, 0x68(%r8)
cmpl $0xd, %ebx
jl 0x2438
movl %r15d, %ebp
movl 0x44(%r8), %edx
movl 0x48(%r8), %edi
leaq 0xe5f(%rip), %r12       # 0x3080
xorl %esi, %esi
movl %r15d, 0x14(%rsp)
movq %r13, 0x58(%rsp)
movq %rsi, 0x38(%rsp)
incl %edx
movl %edx, %eax
imull %r14d, %eax
movl %edi, %ecx
imull %ebp, %ecx
cmpl %ecx, %eax
jle 0x23cb
movq 0x38(%rsp), %rax
imulq %r13, %rax
addq %rax, %rax
movq %rax, 0x50(%rsp)
movq %r8, %rdi
movl $0x1, %esi
movq %r8, %rbx
callq 0x272a
testl %eax, %eax
je 0x24bb
movl 0x64(%rbx), %eax
movl 0x44(%rbx), %edx
movl 0x48(%rbx), %edi
testl %r13d, %r13d
movq %rbx, %r8
jle 0x23aa
movq 0x10(%r8), %r10
movl %eax, 0x18(%rsp)
imull %r13d, %eax
movslq %eax, %r11
addq %r11, %r11
addq 0x8(%r8), %r11
movl %edi, 0x48(%rsp)
movl %edi, %eax
imull %ebp, %eax
incl %edx
movl %edx, 0x1c(%rsp)
imull %r14d, %edx
notl %eax
movl %edx, 0x40(%rsp)
addl %edx, %eax
imull $0x32, %eax, %eax
cltd
idivl %r14d
movl %edx, %ecx
addq 0x50(%rsp), %r10
movl %r14d, %ebp
subl %edx, %ebp
movslq 0x50(%r8), %rsi
movslq %eax, %r8
addq %rsi, %rsi
leaq (%r12,%r8,2), %r9
addq %r8, %r8
xorl %edi, %edi
movq %r11, 0x20(%rsp)
movl $0x2, %ebx
movq %r10, 0x60(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movswl -0x2(%r9,%rbx), %edx
imull %ebp, %edx
leaq (%r8,%rbx), %rax
movswl (%r12,%rax), %eax
imull %ecx, %eax
addl %edx, %eax
addl %eax, %eax
cltd
idivl %r14d
movswl (%r10), %edx
imull %eax, %edx
leal (%rdx,%r13), %r11d
movl %r11d, %eax
xorl %r13d, %eax
jns 0x2338
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 %rsi, %r10
movl %r11d, %r13d
cmpq $0x4b2, %rbx            # imm = 0x4B2
jne 0x22f1
movw $0x7fff, %dx            # imm = 0x7FFF
testl %r15d, %r15d
movq 0x58(%rsp), %r13
movq 0x60(%rsp), %r10
movq 0x20(%rsp), %rax
jg 0x2377
js 0x236e
shrl $0x10, %r11d
movl %r11d, %edx
jmp 0x2372
movw $0x8000, %dx            # imm = 0x8000
movq 0x20(%rsp), %rax
movw %dx, (%rax)
addq $0x2, %rax
addq $0x2, %r10
incl %edi
cmpl %r13d, %edi
movq %rax, %r11
jne 0x22dc
movq (%rsp), %r8
movl 0x14(%rsp), %ebp
movl 0x1c(%rsp), %edx
movl 0x48(%rsp), %edi
movl 0x18(%rsp), %eax
movl 0x40(%rsp), %ecx
jmp 0x23b2
incl %edx
movl %edx, %ecx
imull %r14d, %ecx
incl %edi
movl %edi, 0x48(%r8)
incl %eax
movl %eax, 0x64(%r8)
movl %edi, %eax
imull %ebp, %eax
cmpl %eax, %ecx
jg 0x2258
movl %edx, 0x44(%r8)
cmpl %ebp, %edx
jne 0x23df
movq $0x0, 0x44(%r8)
xorl %edi, %edi
xorl %edx, %edx
movq 0x38(%rsp), %rsi
incq %rsi
movslq 0x68(%r8), %rax
leaq -0xc(%rax), %rcx
cmpq %rcx, %rsi
jl 0x222d
movl %eax, %ecx
subl %esi, %ecx
je 0x242e
movq 0x10(%r8), %rdi
movslq 0x50(%r8), %rax
movslq %esi, %rdx
imulq %rax, %rdx
movq %rsi, %rbx
leaq (%rdi,%rdx,2), %rsi
movslq %ecx, %rdx
imulq %rax, %rdx
addq %rdx, %rdx
callq 0x1130
movq %rbx, %rsi
movq (%rsp), %r8
movl 0x68(%r8), %eax
subl %esi, %eax
movl %eax, 0x68(%r8)
movl 0x8(%rsp), %eax
movss 0x2c(%r8), %xmm0
ucomiss 0xbd7(%rip), %xmm0      # 0x301c
jne 0x2449
jnp 0x24bf
movl 0x50(%r8), %ecx
movl 0x64(%r8), %edx
subl %eax, %edx
imull %ecx, %edx
testl %edx, %edx
movl %eax, %esi
movl $0x1, %eax
je 0x24c4
mulss 0xbbb(%rip), %xmm0      # 0x3024
cvttss2si %xmm0, %r10d
imull %esi, %ecx
movslq %ecx, %rcx
addq %rcx, %rcx
addq 0x8(%r8), %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 0x24ad
movl $0x7fff, %r8d           # imm = 0x7FFF
movw %r8w, (%rcx,%rsi,2)
incq %rsi
cmpl %esi, %edx
jne 0x248a
jmp 0x24c4
xorl %eax, %eax
jmp 0x24c4
movl $0x1, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq