// File: /workspace/github_c_makefile_star2_O0/pipde[P]deos-songlib/lib/songlib.c
// Function: interp3
int
interp3(int *data,int length,double t)
    {
    int x;
    double mu,mu2;
    int y0,y1,y2,y3;
    int a0,a1,a2,a3;

    if (t >= length) return data[length - 1];

    x = (int) t;
    mu = t - x;
    mu2 = mu * mu;

    y1 = data[x];
    if (x == 0)
        {
        y2 = data[x + 1];
        y3 = data[x + 2];
        y0 = y1 + y1 - y2;
        }
    else if (x == length - 2)
        {
        y0 = data[x - 1];
        y2 = data[x + 1];
        y3 = y2 + y2 - y1;
        }
    else if (x == length - 1)
        {
        y0 = data[x - 1];
        y2 = y1 + y1 - y0;
        y3 = y2 + y2 - y1;
        }
    else
        {
        y0 = data[x - 1];
        y2 = data[x + 1];
        y3 = data[x + 2];
        }
        
    a0 = y3 - y2 - y0 + y1;
    a1 = y0 - y1 - a0;
    a2 = y2 - y0;
    a3 = y1;

    return (int) (a0*mu*mu2+a1*mu2+a2*mu+a3);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
cvtsi2sdl -0x14(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jb 0x6538
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x66d2
cvttsd2si -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movsd -0x20(%rbp), %xmm0
cvtsi2sdl -0x24(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x65ad
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x48(%rbp)
movl -0x40(%rbp), %eax
addl -0x40(%rbp), %eax
subl -0x44(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x6665
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jne 0x65ee
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl -0x44(%rbp), %eax
subl -0x40(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x6663
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x6628
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl -0x40(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl -0x44(%rbp), %eax
subl -0x40(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x6661
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x48(%rbp)
jmp 0x6663
jmp 0x6665
movl -0x48(%rbp), %eax
subl -0x44(%rbp), %eax
subl -0x3c(%rbp), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x3c(%rbp), %eax
subl -0x40(%rbp), %eax
subl -0x4c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x44(%rbp), %eax
subl -0x3c(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x58(%rbp)
cvtsi2sdl -0x4c(%rbp), %xmm1
mulsd -0x30(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
cvtsi2sdl -0x50(%rbp), %xmm0
mulsd -0x38(%rbp), %xmm0
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvtsi2sdl -0x54(%rbp), %xmm0
movsd -0x30(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl -0x58(%rbp), %xmm1
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)