#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double fabs(double);
void value_to_rgb(double value, double color[3], double mincolor,
                  double maxcolor, int color_mapping_style,
                  double *interval_point, int interval_mapping_num,
                  int color_system_type) {
  double r, g, b;
  int i;
  if (color_mapping_style == 1) {
    if (fabs(maxcolor - mincolor) > 0.00000001)
      value = (value - mincolor) / (maxcolor - mincolor);
  }
  if (color_mapping_style == 2) {
    mincolor = interval_point[0];
    maxcolor = interval_point[1];
    if (fabs(maxcolor - mincolor) > 0.00000001)
      value = (value - mincolor) / (maxcolor - mincolor);
  }
  if ((color_mapping_style == 3) || (color_mapping_style == 4)) {
    if (value < interval_point[0])
      value = 0.0;
    else if (value > interval_point[interval_mapping_num * 2])
      value = 1.0;
    else {
      for (i = 1; i < interval_mapping_num + 1; i++) {
        if ((value <= interval_point[i * 2]) &&
            (value > interval_point[(i - 1) * 2])) {
          value = (value - interval_point[(i - 1) * 2]) /
                      (interval_point[i * 2] - interval_point[(i - 1) * 2]) *
                      (interval_point[i * 2 + 1] -
                       interval_point[(i - 1) * 2 + 1]) +
                  interval_point[(i - 1) * 2 + 1];
        }
      }
    }
  }
  if (color_system_type == 1) {
    if (value < 0.0)
      value = 0.0;
    if (value > 1.0)
      value = 1.0;
    if (value <= 0.25) {
      r = 0.0;
      g = value * 4.0;
      b = 1.0;
    } else if ((value > 0.25) && (value <= 0.5)) {
      r = 0.0;
      g = 1.0;
      b = (0.5 - value) * 4.0;
    } else if ((value > 0.5) && (value <= 0.75)) {
      r = (value - 0.5) * 4.0;
      g = 1.0;
      b = 0.0;
    } else if (value > 0.75) {
      r = 1.0;
      g = (1.0 - value) * 4.0;
      b = 0.0;
    }
  } else if (color_system_type == 2) {
    if (value < 0.0)
      value = 0.0;
    if (value > 1.0)
      value = 1.0;
    if (value <= 0.2) {
      g = 0.0;
      b = 1.0;
      r = (0.2 - value) * 5.0;
    } else if ((value > 0.2) && (value <= 0.4)) {
      r = 0.0;
      b = 1.0;
      g = (value - 0.2) * 5.0;
    } else if ((value > 0.4) && (value <= 0.6)) {
      r = 0.0;
      g = 1.0;
      b = 1.0 - (value - 0.4) * 5.0;
    } else if ((value > 0.6) && (value <= 0.8)) {
      r = (value - 0.6) * 5.0;
      g = 1.0;
      b = 0.0;
    } else if (value > 0.0) {
      r = 1.0;
      g = 1.0 - (value - 0.8) * 5.0;
      b = 0.0;
    }
  } else if (color_system_type == 3) {
    r = g = b = value;
  }
  color[0] = r;
  color[1] = g;
  color[2] = b;
  return;
}


x86 assembly (clang, -O0):
<value_to_rgb>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
mov    %r8d,-0x38(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    1178 <value_to_rgb+0x78>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xf20(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1173 <value_to_rgb+0x73>
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1178 <value_to_rgb+0x78>
cmpl   $0x2,-0x24(%rbp)
jne    11e6 <value_to_rgb+0xe6>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xeb2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe46(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e1 <value_to_rgb+0xe1>
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e6 <value_to_rgb+0xe6>
cmpl   $0x3,-0x24(%rbp)
je     11fa <value_to_rgb+0xfa>
cmpl   $0x4,-0x24(%rbp)
jne    135f <value_to_rgb+0x25f>
movsd  -0x8(%rbp),%xmm1
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    121e <value_to_rgb+0x11e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    135a <value_to_rgb+0x25a>
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    124d <value_to_rgb+0x14d>
movsd  0xdc5(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1355 <value_to_rgb+0x255>
movl   $0x1,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1350 <value_to_rgb+0x250>
movsd  -0x8(%rbp),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jb     133d <value_to_rgb+0x23d>
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    133d <value_to_rgb+0x23d>
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1342 <value_to_rgb+0x242>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1254 <value_to_rgb+0x154>
jmp    1355 <value_to_rgb+0x255>
jmp    135a <value_to_rgb+0x25a>
jmp    135f <value_to_rgb+0x25f>
cmpl   $0x1,-0x38(%rbp)
jne    1508 <value_to_rgb+0x408>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    137f <value_to_rgb+0x27f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xc7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13a3 <value_to_rgb+0x2a3>
movsd  0xc6a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xc8d(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     13e2 <value_to_rgb+0x2e2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xc8a(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xc30(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1503 <value_to_rgb+0x403>
movsd  -0x8(%rbp),%xmm0
movsd  0xc49(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1444 <value_to_rgb+0x344>
movsd  0xc3f(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1444 <value_to_rgb+0x344>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xbec(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xc17(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xc1a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    14fe <value_to_rgb+0x3fe>
movsd  -0x8(%rbp),%xmm0
movsd  0xbef(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    14aa <value_to_rgb+0x3aa>
movsd  0xbe5(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     14aa <value_to_rgb+0x3aa>
movsd  -0x8(%rbp),%xmm0
movsd  0xbc5(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xbc9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xb70(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    14f9 <value_to_rgb+0x3f9>
movsd  -0x8(%rbp),%xmm0
movsd  0xb91(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    14f4 <value_to_rgb+0x3f4>
movsd  0xb3f(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xb32(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xb6d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    14f9 <value_to_rgb+0x3f9>
jmp    14fe <value_to_rgb+0x3fe>
jmp    1503 <value_to_rgb+0x403>
jmp    1799 <value_to_rgb+0x699>
cmpl   $0x2,-0x38(%rbp)
jne    1771 <value_to_rgb+0x671>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1528 <value_to_rgb+0x428>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xad3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    154c <value_to_rgb+0x44c>
movsd  0xac1(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xabc(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1597 <value_to_rgb+0x497>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xa99(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xa94(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xaa7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    176c <value_to_rgb+0x66c>
movsd  -0x8(%rbp),%xmm0
movsd  0xa6c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15fd <value_to_rgb+0x4fd>
movsd  0xa62(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     15fd <value_to_rgb+0x4fd>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xa37(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xa2d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xa41(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1767 <value_to_rgb+0x667>
movsd  -0x8(%rbp),%xmm0
movsd  0xa0e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1686 <value_to_rgb+0x586>
movsd  0xa04(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1686 <value_to_rgb+0x586>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0x9d1(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0x9cf(%rip),%xmm1
subsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0x9c4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x990(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1762 <value_to_rgb+0x662>
movsd  -0x8(%rbp),%xmm0
movsd  0x98d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    16ec <value_to_rgb+0x5ec>
movsd  0x983(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     16ec <value_to_rgb+0x5ec>
movsd  -0x8(%rbp),%xmm0
movsd  0x963(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0x967(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0x92e(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    175d <value_to_rgb+0x65d>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1758 <value_to_rgb+0x658>
movsd  0x902(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0x910(%rip),%xmm1
subsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0x8f5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x8c1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    175d <value_to_rgb+0x65d>
jmp    1762 <value_to_rgb+0x662>
jmp    1767 <value_to_rgb+0x667>
jmp    176c <value_to_rgb+0x66c>
jmp    1794 <value_to_rgb+0x694>
cmpl   $0x3,-0x38(%rbp)
jne    178f <value_to_rgb+0x68f>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  %xmm0,-0x48(%rbp)
movsd  %xmm0,-0x40(%rbp)
jmp    1794 <value_to_rgb+0x694>
jmp    1799 <value_to_rgb+0x699>
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<value_to_rgb>:
cmp    $0x2,%esi
je     112e <value_to_rgb+0x2e>
cmp    $0x1,%esi
jne    115b <value_to_rgb+0x5b>
subsd  %xmm1,%xmm2
movapd 0xeea(%rip),%xmm3
andpd  %xmm2,%xmm3
ucomisd 0xeee(%rip),%xmm3
jbe    11a3 <value_to_rgb+0xa3>
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
jmp    11a3 <value_to_rgb+0xa3>
movsd  (%rdx),%xmm2
movsd  0x8(%rdx),%xmm1
subsd  %xmm2,%xmm1
movapd 0xebd(%rip),%xmm3
andpd  %xmm1,%xmm3
ucomisd 0xec1(%rip),%xmm3
jbe    11a3 <value_to_rgb+0xa3>
subsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
jmp    11a3 <value_to_rgb+0xa3>
add    $0xfffffffd,%esi
cmp    $0x1,%esi
ja     11a3 <value_to_rgb+0xa3>
movsd  (%rdx),%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm2
ja     11a7 <value_to_rgb+0xa7>
lea    (%rcx,%rcx,1),%eax
cltq
ucomisd (%rdx,%rax,8),%xmm0
jbe    1187 <value_to_rgb+0x87>
movsd  0xe93(%rip),%xmm1
jmp    11a7 <value_to_rgb+0xa7>
test   %ecx,%ecx
jle    11a3 <value_to_rgb+0xa3>
mov    %ecx,%eax
shl    $0x4,%rax
add    $0x10,%rax
mov    $0x10,%ecx
movapd %xmm0,%xmm1
jmp    123d <value_to_rgb+0x13d>
movapd %xmm0,%xmm1
cmp    $0x2,%r8d
je     127e <value_to_rgb+0x17e>
cmp    $0x1,%r8d
jne    12e2 <value_to_rgb+0x1e2>
xorpd  %xmm2,%xmm2
xorpd  %xmm3,%xmm3
maxsd  %xmm1,%xmm3
movsd  0xe49(%rip),%xmm1
movapd %xmm1,%xmm0
minsd  %xmm3,%xmm0
movsd  0xe91(%rip),%xmm3
ucomisd %xmm0,%xmm3
jae    12ec <value_to_rgb+0x1ec>
ucomisd 0xe7f(%rip),%xmm0
jbe    1311 <value_to_rgb+0x211>
movsd  0xe81(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     1311 <value_to_rgb+0x211>
subsd  %xmm0,%xmm1
mulsd  0xe63(%rip),%xmm1
movsd  0xdfb(%rip),%xmm0
jmp    1302 <value_to_rgb+0x202>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x10,%rcx
cmp    %rcx,%rax
je     11a7 <value_to_rgb+0xa7>
movsd  (%rdx,%rcx,1),%xmm0
ucomisd %xmm1,%xmm0
jb     1230 <value_to_rgb+0x130>
movsd  -0x10(%rdx,%rcx,1),%xmm2
ucomisd %xmm2,%xmm1
jbe    1230 <value_to_rgb+0x130>
subsd  %xmm2,%xmm1
subsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  -0x8(%rdx,%rcx,1),%xmm0
movsd  0x8(%rdx,%rcx,1),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm2,%xmm1
jmp    1230 <value_to_rgb+0x130>
xorpd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
maxsd  %xmm1,%xmm2
movsd  0xd86(%rip),%xmm1
movapd %xmm1,%xmm3
minsd  %xmm2,%xmm3
movsd  0xd7e(%rip),%xmm2
ucomisd %xmm3,%xmm2
jae    12f6 <value_to_rgb+0x1f6>
ucomisd 0xd70(%rip),%xmm3
jbe    134b <value_to_rgb+0x24b>
movsd  0xd72(%rip),%xmm0
ucomisd %xmm3,%xmm0
jb     134b <value_to_rgb+0x24b>
addsd  0xd98(%rip),%xmm3
mulsd  0xd50(%rip),%xmm3
xorpd  %xmm2,%xmm2
movapd %xmm3,%xmm0
jmp    1302 <value_to_rgb+0x202>
movapd %xmm1,%xmm2
movapd %xmm1,%xmm0
jmp    1302 <value_to_rgb+0x202>
mulsd  0xd84(%rip),%xmm0
jmp    1302 <value_to_rgb+0x202>
subsd  %xmm3,%xmm2
mulsd  0xd26(%rip),%xmm2
movsd  %xmm2,(%rdi)
movsd  %xmm0,0x8(%rdi)
movsd  %xmm1,0x10(%rdi)
ret
ucomisd 0xd67(%rip),%xmm0
jbe    138c <value_to_rgb+0x28c>
movsd  0xd65(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     138c <value_to_rgb+0x28c>
addsd  0xd5f(%rip),%xmm0
mulsd  0xd3f(%rip),%xmm0
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
movsd  0xccf(%rip),%xmm0
jmp    1302 <value_to_rgb+0x202>
ucomisd 0xcdd(%rip),%xmm3
jbe    13bb <value_to_rgb+0x2bb>
movsd  0xcdb(%rip),%xmm0
ucomisd %xmm3,%xmm0
jb     13bb <value_to_rgb+0x2bb>
addsd  0xcf5(%rip),%xmm3
mulsd  0xcdd(%rip),%xmm3
movsd  0xc9d(%rip),%xmm0
addsd  %xmm0,%xmm3
xorpd  %xmm2,%xmm2
movapd %xmm3,%xmm1
jmp    1302 <value_to_rgb+0x202>
ucomisd 0xcf4(%rip),%xmm0
jbe    1302 <value_to_rgb+0x202>
movsd  0xc76(%rip),%xmm2
movapd %xmm2,%xmm3
subsd  %xmm0,%xmm3
mulsd  0xcc6(%rip),%xmm3
xorpd  %xmm1,%xmm1
jmp    12dc <value_to_rgb+0x1dc>
ucomisd 0xc75(%rip),%xmm3
jbe    13f8 <value_to_rgb+0x2f8>
movsd  0xc73(%rip),%xmm0
ucomisd %xmm3,%xmm0
jb     13f8 <value_to_rgb+0x2f8>
addsd  0xc7d(%rip),%xmm3
mulsd  0xc45(%rip),%xmm3
xorpd  %xmm1,%xmm1
movsd  0xc29(%rip),%xmm0
movapd %xmm3,%xmm2
jmp    1302 <value_to_rgb+0x202>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
jbe    1302 <value_to_rgb+0x202>
addsd  0xc3a(%rip),%xmm3
mulsd  0xc3a(%rip),%xmm3
movsd  0xbfa(%rip),%xmm2
addsd  %xmm2,%xmm3
jmp    12dc <value_to_rgb+0x1dc>

LLVM IR (-O0):
define void @value_to_rgb(double %0, double* %1, double %2, double %3, i32 %4, double* %5, i32 %6, i32 %7) {
%9 = alloca double
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca i32
store double %0, double* %9
store double* %1, double** %10
store double %2, double* %11
store double %3, double* %12
store i32 %4, i32* %13
store double* %5, double** %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%21 = load i32, i32* %13
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %38
23: ; preds = %8
%24 = load double, double* %12
%25 = load double, double* %11
%26 = fsub double %24, %25
%27 = call double @llvm.fabs.f64(double %26)
%28 = fcmp ogt double %27, 1.000000e-08
br i1 %28, label %29, label %37
29: ; preds = %23
%30 = load double, double* %9
%31 = load double, double* %11
%32 = fsub double %30, %31
%33 = load double, double* %12
%34 = load double, double* %11
%35 = fsub double %33, %34
%36 = fdiv double %32, %35
store double %36, double* %9
br label %37
37: ; preds = %29, %23
br label %38
38: ; preds = %37, %8
%39 = load i32, i32* %13
%40 = icmp eq i32 %39, 2
br i1 %40, label %41, label %62
41: ; preds = %38
%42 = load double*, double** %14
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = load double, double* %43
store double %44, double* %11
%45 = load double*, double** %14
%46 = getelementptr inbounds double, double* %45, i64 1
%47 = load double, double* %46
store double %47, double* %12
%48 = load double, double* %12
%49 = load double, double* %11
%50 = fsub double %48, %49
%51 = call double @llvm.fabs.f64(double %50)
%52 = fcmp ogt double %51, 1.000000e-08
br i1 %52, label %53, label %61
53: ; preds = %41
%54 = load double, double* %9
%55 = load double, double* %11
%56 = fsub double %54, %55
%57 = load double, double* %12
%58 = load double, double* %11
%59 = fsub double %57, %58
%60 = fdiv double %56, %59
store double %60, double* %9
br label %61
61: ; preds = %53, %41
br label %62
62: ; preds = %61, %38
%63 = load i32, i32* %13
%64 = icmp eq i32 %63, 3
br i1 %64, label %68, label %65
65: ; preds = %62
%66 = load i32, i32* %13
%67 = icmp eq i32 %66, 4
br i1 %67, label %68, label %167
68: ; preds = %65, %62
%69 = load double, double* %9
%70 = load double*, double** %14
%71 = getelementptr inbounds double, double* %70, i64 0
%72 = load double, double* %71
%73 = fcmp olt double %69, %72
br i1 %73, label %74, label %75
74: ; preds = %68
store double 0.000000e+00, double* %9
br label %166
75: ; preds = %68
%76 = load double, double* %9
%77 = load double*, double** %14
%78 = load i32, i32* %15
%79 = mul nsw i32 %78, 2
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %77, i64 %80
%82 = load double, double* %81
%83 = fcmp ogt double %76, %82
br i1 %83, label %84, label %85
84: ; preds = %75
store double 1.000000e+00, double* %9
br label %165
85: ; preds = %75
store i32 1, i32* %20
br label %86
86: ; preds = %161, %85
%87 = load i32, i32* %20
%88 = load i32, i32* %15
%89 = add nsw i32 %88, 1
%90 = icmp slt i32 %87, %89
br i1 %90, label %91, label %164
91: ; preds = %86
%92 = load double, double* %9
%93 = load double*, double** %14
%94 = load i32, i32* %20
%95 = mul nsw i32 %94, 2
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %93, i64 %96
%98 = load double, double* %97
%99 = fcmp ole double %92, %98
br i1 %99, label %100, label %160
100: ; preds = %91
%101 = load double, double* %9
%102 = load double*, double** %14
%103 = load i32, i32* %20
%104 = sub nsw i32 %103, 1
%105 = mul nsw i32 %104, 2
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %102, i64 %106
%108 = load double, double* %107
%109 = fcmp ogt double %101, %108
br i1 %109, label %110, label %160
110: ; preds = %100
%111 = load double, double* %9
%112 = load double*, double** %14
%113 = load i32, i32* %20
%114 = sub nsw i32 %113, 1
%115 = mul nsw i32 %114, 2
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %112, i64 %116
%118 = load double, double* %117
%119 = fsub double %111, %118
%120 = load double*, double** %14
%121 = load i32, i32* %20
%122 = mul nsw i32 %121, 2
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %120, i64 %123
%125 = load double, double* %124
%126 = load double*, double** %14
%127 = load i32, i32* %20
%128 = sub nsw i32 %127, 1
%129 = mul nsw i32 %128, 2
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %126, i64 %130
%132 = load double, double* %131
%133 = fsub double %125, %132
%134 = fdiv double %119, %133
%135 = load double*, double** %14
%136 = load i32, i32* %20
%137 = mul nsw i32 %136, 2
%138 = add nsw i32 %137, 1
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %135, i64 %139
%141 = load double, double* %140
%142 = load double*, double** %14
%143 = load i32, i32* %20
%144 = sub nsw i32 %143, 1
%145 = mul nsw i32 %144, 2
%146 = add nsw i32 %145, 1
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %142, i64 %147
%149 = load double, double* %148
%150 = fsub double %141, %149
%151 = load double*, double** %14
%152 = load i32, i32* %20
%153 = sub nsw i32 %152, 1
%154 = mul nsw i32 %153, 2
%155 = add nsw i32 %154, 1
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double, double* %151, i64 %156
%158 = load double, double* %157
%159 = call double @llvm.fmuladd.f64(double %134, double %150, double %158)
store double %159, double* %9
br label %160
160: ; preds = %110, %100, %91
br label %161
161: ; preds = %160
%162 = load i32, i32* %20
%163 = add nsw i32 %162, 1
store i32 %163, i32* %20
br label %86
164: ; preds = %86
br label %165
165: ; preds = %164, %84
br label %166
166: ; preds = %165, %74
br label %167
167: ; preds = %166, %65
%168 = load i32, i32* %16
%169 = icmp eq i32 %168, 1
br i1 %169, label %170, label %215
170: ; preds = %167
%171 = load double, double* %9
%172 = fcmp olt double %171, 0.000000e+00
br i1 %172, label %173, label %174
173: ; preds = %170
store double 0.000000e+00, double* %9
br label %174
174: ; preds = %173, %170
%175 = load double, double* %9
%176 = fcmp ogt double %175, 1.000000e+00
br i1 %176, label %177, label %178
177: ; preds = %174
store double 1.000000e+00, double* %9
br label %178
178: ; preds = %177, %174
%179 = load double, double* %9
%180 = fcmp ole double %179, 2.500000e-01
br i1 %180, label %181, label %184
181: ; preds = %178
store double 0.000000e+00, double* %17
%182 = load double, double* %9
%183 = fmul double %182, 4.000000e+00
store double %183, double* %18
store double 1.000000e+00, double* %19
br label %214
184: ; preds = %178
%185 = load double, double* %9
%186 = fcmp ogt double %185, 2.500000e-01
br i1 %186, label %187, label %194
187: ; preds = %184
%188 = load double, double* %9
%189 = fcmp ole double %188, 5.000000e-01
br i1 %189, label %190, label %194
190: ; preds = %187
store double 0.000000e+00, double* %17
store double 1.000000e+00, double* %18
%191 = load double, double* %9
%192 = fsub double 5.000000e-01, %191
%193 = fmul double %192, 4.000000e+00
store double %193, double* %19
br label %213
194: ; preds = %187, %184
%195 = load double, double* %9
%196 = fcmp ogt double %195, 5.000000e-01
br i1 %196, label %197, label %204
197: ; preds = %194
%198 = load double, double* %9
%199 = fcmp ole double %198, 7.500000e-01
br i1 %199, label %200, label %204
200: ; preds = %197
%201 = load double, double* %9
%202 = fsub double %201, 5.000000e-01
%203 = fmul double %202, 4.000000e+00
store double %203, double* %17
store double 1.000000e+00, double* %18
store double 0.000000e+00, double* %19
br label %212
204: ; preds = %197, %194
%205 = load double, double* %9
%206 = fcmp ogt double %205, 7.500000e-01
br i1 %206, label %207, label %211
207: ; preds = %204
store double 1.000000e+00, double* %17
%208 = load double, double* %9
%209 = fsub double 1.000000e+00, %208
%210 = fmul double %209, 4.000000e+00
store double %210, double* %18
store double 0.000000e+00, double* %19
br label %211
211: ; preds = %207, %204
br label %212
212: ; preds = %211, %200
br label %213
213: ; preds = %212, %190
br label %214
214: ; preds = %213, %181
br label %284
215: ; preds = %167
%216 = load i32, i32* %16
%217 = icmp eq i32 %216, 2
br i1 %217, label %218, label %277
218: ; preds = %215
%219 = load double, double* %9
%220 = fcmp olt double %219, 0.000000e+00
br i1 %220, label %221, label %222
221: ; preds = %218
store double 0.000000e+00, double* %9
br label %222
222: ; preds = %221, %218
%223 = load double, double* %9
%224 = fcmp ogt double %223, 1.000000e+00
br i1 %224, label %225, label %226
225: ; preds = %222
store double 1.000000e+00, double* %9
br label %226
226: ; preds = %225, %222
%227 = load double, double* %9
%228 = fcmp ole double %227, 2.000000e-01
br i1 %228, label %229, label %233
229: ; preds = %226
store double 0.000000e+00, double* %18
store double 1.000000e+00, double* %19
%230 = load double, double* %9
%231 = fsub double 2.000000e-01, %230
%232 = fmul double %231, 5.000000e+00
store double %232, double* %17
br label %276
233: ; preds = %226
%234 = load double, double* %9
%235 = fcmp ogt double %234, 2.000000e-01
br i1 %235, label %236, label %243
236: ; preds = %233
%237 = load double, double* %9
%238 = fcmp ole double %237, 4.000000e-01
br i1 %238, label %239, label %243
239: ; preds = %236
store double 0.000000e+00, double* %17
store double 1.000000e+00, double* %19
%240 = load double, double* %9
%241 = fsub double %240, 2.000000e-01
%242 = fmul double %241, 5.000000e+00
store double %242, double* %18
br label %275
243: ; preds = %236, %233
%244 = load double, double* %9
%245 = fcmp ogt double %244, 4.000000e-01
br i1 %245, label %246, label %254
246: ; preds = %243
%247 = load double, double* %9
%248 = fcmp ole double %247, 6.000000e-01
br i1 %248, label %249, label %254
249: ; preds = %246
store double 0.000000e+00, double* %17
store double 1.000000e+00, double* %18
%250 = load double, double* %9
%251 = fsub double %250, 4.000000e-01
%252 = fneg double %251
%253 = call double @llvm.fmuladd.f64(double %252, double 5.000000e+00, double 1.000000e+00)
store double %253, double* %19
br label %274
254: ; preds = %246, %243
%255 = load double, double* %9
%256 = fcmp ogt double %255, 6.000000e-01
br i1 %256, label %257, label %264
257: ; preds = %254
%258 = load double, double* %9
%259 = fcmp ole double %258, 8.000000e-01
br i1 %259, label %260, label %264
260: ; preds = %257
%261 = load double, double* %9
%262 = fsub double %261, 6.000000e-01
%263 = fmul double %262, 5.000000e+00
store double %263, double* %17
store double 1.000000e+00, double* %18
store double 0.000000e+00, double* %19
br label %273
264: ; preds = %257, %254
%265 = load double, double* %9
%266 = fcmp ogt double %265, 0.000000e+00
br i1 %266, label %267, label %272
267: ; preds = %264
store double 1.000000e+00, double* %17
%268 = load double, double* %9
%269 = fsub double %268, 8.000000e-01
%270 = fneg double %269
%271 = call double @llvm.fmuladd.f64(double %270, double 5.000000e+00, double 1.000000e+00)
store double %271, double* %18
store double 0.000000e+00, double* %19
br label %272
272: ; preds = %267, %264
br label %273
273: ; preds = %272, %260
br label %274
274: ; preds = %273, %249
br label %275
275: ; preds = %274, %239
br label %276
276: ; preds = %275, %229
br label %283
277: ; preds = %215
%278 = load i32, i32* %16
%279 = icmp eq i32 %278, 3
br i1 %279, label %280, label %282
280: ; preds = %277
%281 = load double, double* %9
store double %281, double* %19
store double %281, double* %18
store double %281, double* %17
br label %282
282: ; preds = %280, %277
br label %283
283: ; preds = %282, %276
br label %284
284: ; preds = %283, %214
%285 = load double, double* %17
%286 = load double*, double** %10
%287 = getelementptr inbounds double, double* %286, i64 0
store double %285, double* %287
%288 = load double, double* %18
%289 = load double*, double** %10
%290 = getelementptr inbounds double, double* %289, i64 1
store double %288, double* %290
%291 = load double, double* %19
%292 = load double*, double** %10
%293 = getelementptr inbounds double, double* %292, i64 2
store double %291, double* %293
ret void
}

LLVM IR (-O2):
define void @value_to_rgb(double %0, double* nocapture writeonly %1, double %2, double %3, i32 %4, double* nocapture %5, i32 %6, i32 %7) {
switch i32 %4, label %26 [
i32 1, label %9
i32 2, label %16
]
9: ; preds = %8
%10 = fsub double %3, %2
%11 = tail call double @llvm.fabs.f64(double %10)
%12 = fcmp ogt double %11, 1.000000e-08
br i1 %12, label %13, label %71
13: ; preds = %9
%14 = fsub double %0, %2
%15 = fdiv double %14, %10
br label %71
16: ; preds = %8
%17 = load double, double* %5
%18 = getelementptr inbounds double, double* %5, i64 1
%19 = load double, double* %18
%20 = fsub double %19, %17
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = fcmp ogt double %21, 1.000000e-08
br i1 %22, label %23, label %71
23: ; preds = %16
%24 = fsub double %0, %17
%25 = fdiv double %24, %20
br label %71
26: ; preds = %8
%27 = add i32 %4, -3
%28 = icmp ult i32 %27, 2
br i1 %28, label %29, label %71
29: ; preds = %26
%30 = load double, double* %5
%31 = fcmp ogt double %30, %0
br i1 %31, label %71, label %32
32: ; preds = %29
%33 = shl nsw i32 %6, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %5, i64 %34
%36 = load double, double* %35
%37 = fcmp olt double %36, %0
br i1 %37, label %71, label %38
38: ; preds = %32
%39 = icmp slt i32 %6, 1
br i1 %39, label %71, label %40
40: ; preds = %38
%41 = add nuw i32 %6, 1
%42 = zext i32 %41 to i64
br label %43
43: ; preds = %40, %67
%44 = phi i64 [ 1, %40 ], [ %69, %67 ]
%45 = phi double [ %0, %40 ], [ %68, %67 ]
%46 = shl nuw nsw i64 %44, 1
%47 = getelementptr inbounds double, double* %5, i64 %46
%48 = load double, double* %47
%49 = fcmp ugt double %45, %48
br i1 %49, label %67, label %50
50: ; preds = %43
%51 = add nsw i64 %46, -2
%52 = getelementptr inbounds double, double* %5, i64 %51
%53 = load double, double* %52
%54 = fcmp ogt double %45, %53
br i1 %54, label %55, label %67
55: ; preds = %50
%56 = fsub double %45, %53
%57 = fsub double %48, %53
%58 = fdiv double %56, %57
%59 = or i64 %46, 1
%60 = getelementptr inbounds double, double* %5, i64 %59
%61 = load double, double* %60
%62 = add nsw i64 %46, -1
%63 = getelementptr inbounds double, double* %5, i64 %62
%64 = load double, double* %63
%65 = fsub double %61, %64
%66 = tail call double @llvm.fmuladd.f64(double %58, double %65, double %64)
br label %67
67: ; preds = %43, %50, %55
%68 = phi double [ %66, %55 ], [ %45, %50 ], [ %45, %43 ]
%69 = add nuw nsw i64 %44, 1
%70 = icmp eq i64 %69, %42
br i1 %70, label %71, label %43
71: ; preds = %67, %38, %13, %9, %23, %16, %32, %29, %26
%72 = phi double [ %0, %26 ], [ 0.000000e+00, %29 ], [ 1.000000e+00, %32 ], [ %0, %16 ], [ %25, %23 ], [ %0, %9 ], [ %15, %13 ], [ %0, %38 ], [ %68, %67 ]
switch i32 %7, label %137 [
i32 1, label %73
i32 2, label %100
]
73: ; preds = %71
%74 = fcmp olt double %72, 0.000000e+00
%75 = select i1 %74, double 0.000000e+00, double %72
%76 = fcmp ogt double %75, 1.000000e+00
%77 = select i1 %76, double 1.000000e+00, double %75
%78 = fcmp ugt double %77, 2.500000e-01
br i1 %78, label %81, label %79
79: ; preds = %73
%80 = fmul double %77, 4.000000e+00
br label %137
81: ; preds = %73
%82 = fcmp ogt double %77, 2.500000e-01
%83 = fcmp ole double %77, 5.000000e-01
%84 = and i1 %82, %83
br i1 %84, label %85, label %88
85: ; preds = %81
%86 = fsub double 5.000000e-01, %77
%87 = fmul double %86, 4.000000e+00
br label %137
88: ; preds = %81
%89 = fcmp ogt double %77, 5.000000e-01
%90 = fcmp ole double %77, 7.500000e-01
%91 = and i1 %89, %90
br i1 %91, label %92, label %95
92: ; preds = %88
%93 = fadd double %77, -5.000000e-01
%94 = fmul double %93, 4.000000e+00
br label %137
95: ; preds = %88
%96 = fcmp ogt double %77, 7.500000e-01
br i1 %96, label %97, label %137
97: ; preds = %95
%98 = fsub double 1.000000e+00, %77
%99 = fmul double %98, 4.000000e+00
br label %137
100: ; preds = %71
%101 = fcmp olt double %72, 0.000000e+00
%102 = select i1 %101, double 0.000000e+00, double %72
%103 = fcmp ogt double %102, 1.000000e+00
%104 = select i1 %103, double 1.000000e+00, double %102
%105 = fcmp ugt double %104, 2.000000e-01
br i1 %105, label %109, label %106
106: ; preds = %100
%107 = fsub double 2.000000e-01, %104
%108 = fmul double %107, 5.000000e+00
br label %137
109: ; preds = %100
%110 = fcmp ogt double %104, 2.000000e-01
%111 = fcmp ole double %104, 4.000000e-01
%112 = and i1 %110, %111
br i1 %112, label %113, label %116
113: ; preds = %109
%114 = fadd double %104, -2.000000e-01
%115 = fmul double %114, 5.000000e+00
br label %137
116: ; preds = %109
%117 = fcmp ogt double %104, 4.000000e-01
%118 = fcmp ole double %104, 6.000000e-01
%119 = and i1 %117, %118
br i1 %119, label %120, label %124
120: ; preds = %116
%121 = fadd double %104, -4.000000e-01
%122 = fneg double %121
%123 = tail call double @llvm.fmuladd.f64(double %122, double 5.000000e+00, double 1.000000e+00)
br label %137
124: ; preds = %116
%125 = fcmp ogt double %104, 6.000000e-01
%126 = fcmp ole double %104, 8.000000e-01
%127 = and i1 %125, %126
br i1 %127, label %128, label %131
128: ; preds = %124
%129 = fadd double %104, -6.000000e-01
%130 = fmul double %129, 5.000000e+00
br label %137
131: ; preds = %124
%132 = fcmp ogt double %104, 0.000000e+00
br i1 %132, label %133, label %137
133: ; preds = %131
%134 = fadd double %104, -8.000000e-01
%135 = fneg double %134
%136 = tail call double @llvm.fmuladd.f64(double %135, double 5.000000e+00, double 1.000000e+00)
br label %137
137: ; preds = %71, %113, %128, %133, %131, %120, %106, %79, %92, %97, %95, %85
%138 = phi double [ 0.000000e+00, %79 ], [ 0.000000e+00, %85 ], [ %94, %92 ], [ 1.000000e+00, %97 ], [ undef, %95 ], [ %108, %106 ], [ 0.000000e+00, %113 ], [ 0.000000e+00, %120 ], [ %130, %128 ], [ 1.000000e+00, %133 ], [ undef, %131 ], [ %72, %71 ]
%139 = phi double [ %80, %79 ], [ 1.000000e+00, %85 ], [ 1.000000e+00, %92 ], [ %99, %97 ], [ undef, %95 ], [ 0.000000e+00, %106 ], [ %115, %113 ], [ 1.000000e+00, %120 ], [ 1.000000e+00, %128 ], [ %136, %133 ], [ undef, %131 ], [ %72, %71 ]
%140 = phi double [ 1.000000e+00, %79 ], [ %87, %85 ], [ 0.000000e+00, %92 ], [ 0.000000e+00, %97 ], [ undef, %95 ], [ 1.000000e+00, %106 ], [ 1.000000e+00, %113 ], [ %123, %120 ], [ 0.000000e+00, %128 ], [ 0.000000e+00, %133 ], [ undef, %131 ], [ %72, %71 ]
store double %138, double* %1
%141 = getelementptr inbounds double, double* %1, i64 1
store double %139, double* %141
%142 = getelementptr inbounds double, double* %1, i64 2
store double %140, double* %142
ret void
}