// File: blackle[P]LZMA-Vizualizer/LzmaSpec.cpp
// Function: ColorGradient::getColorAtValue(float, float&, float&, float&)
void getColorAtValue(const float value, float &red, float &green, float &blue)
  {
    if(color.size()==0)
      return;

    for(int i=0; i<color.size(); i++)
    {
      ColorPoint &currC = color[i];
      if(value < currC.val)
      {
        ColorPoint &prevC  = color[ std::max(0,i-1) ];
        float valueDiff    = (prevC.val - currC.val);
        float fractBetween = (valueDiff==0) ? 0 : (value - currC.val) / valueDiff;
        red   = (prevC.r - currC.r)*fractBetween + currC.r;
        green = (prevC.g - currC.g)*fractBetween + currC.g;
        blue  = (prevC.b - currC.b)*fractBetween + currC.b;
        return;
      }
    }
    red   = color.back().r;
    green = color.back().g;
    blue  = color.back().b;
    return;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x7350
cmpq $0x0, %rax
jne 0x76f5
jmp 0x78a4
movl $0x0, -0x2c(%rbp)
movq -0x58(%rbp), %rdi
movslq -0x2c(%rbp), %rax
movq %rax, -0x60(%rbp)
callq 0x7350
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x7863
movq -0x58(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x7920
movq %rax, -0x38(%rbp)
movss -0xc(%rbp), %xmm1
movq -0x38(%rbp), %rax
movss 0xc(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x7853
movl $0x0, -0x44(%rbp)
movl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
leaq -0x44(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x7940
movq -0x58(%rbp), %rdi
movslq (%rax), %rsi
callq 0x7920
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x38(%rbp), %rax
subss 0xc(%rax), %xmm0
movss %xmm0, -0x4c(%rbp)
movss -0x4c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x77a2
jp 0x77a2
xorps %xmm0, %xmm0
movss %xmm0, -0x64(%rbp)
jmp 0x77ba
movss -0xc(%rbp), %xmm0
movq -0x38(%rbp), %rax
subss 0xc(%rax), %xmm0
divss -0x4c(%rbp), %xmm0
movss %xmm0, -0x64(%rbp)
movss -0x64(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
movq -0x40(%rbp), %rax
movss (%rax), %xmm0
movq -0x38(%rbp), %rax
subss (%rax), %xmm0
movss -0x50(%rbp), %xmm2
movq -0x38(%rbp), %rax
movss (%rax), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x18(%rbp), %rax
movss %xmm0, (%rax)
movq -0x40(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x38(%rbp), %rax
subss 0x4(%rax), %xmm0
movss -0x50(%rbp), %xmm2
movq -0x38(%rbp), %rax
movss 0x4(%rax), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, (%rax)
movq -0x40(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x38(%rbp), %rax
subss 0x8(%rax), %xmm0
movss -0x50(%rbp), %xmm2
movq -0x38(%rbp), %rax
movss 0x8(%rax), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, (%rax)
jmp 0x78a4
jmp 0x7855
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x76fc
movq -0x58(%rbp), %rdi
callq 0x70c0
movq -0x58(%rbp), %rdi
movss (%rax), %xmm0
movq -0x18(%rbp), %rax
movss %xmm0, (%rax)
callq 0x70c0
movq -0x58(%rbp), %rdi
movss 0x4(%rax), %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, (%rax)
callq 0x70c0
movss 0x8(%rax), %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, (%rax)
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)