#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 pow(double, double);
int /*<<< orphan*/ printf(char *);
scalar_t__ round(double);
void luv2rgb(unsigned char *RGB, float *LUV, int size) {
  int i, k;
  double x, y, X, Y, Z, den, u2, v2, X0, Z0, Y0, u20, v20, vec[3];
  X0 = (0.607 + 0.174 + 0.201);
  Y0 = (0.299 + 0.587 + 0.114);
  Z0 = (0.066 + 1.117);
  u20 = 4 * X0 / (X0 + 15 * Y0 + 3 * Z0);
  v20 = 9 * Y0 / (X0 + 15 * Y0 + 3 * Z0);
  for (i = 0; i < size; i += 3) {
    if (LUV[i] > 0) {
      if (LUV[i] < 8.0)
        Y = ((double)LUV[i]) / 903.3;
      else
        Y = pow((((double)LUV[i]) + 16) / 116.0, 3.0);
      u2 = ((double)LUV[i + 1]) / 13.0 / ((double)LUV[i]) + u20;
      v2 = ((double)LUV[i + 2]) / 13.0 / ((double)LUV[i]) + v20;
      den = 6 + 3 * u2 - 8 * v2;
      if (den < 0)
        printf("den<0\n");
      if (den == 0)
        printf("den==0\n");
      x = 4.5 * u2 / den;
      y = 2.0 * v2 / den;
      X = x / y * Y;
      Z = (1 - x - y) / y * Y;
    } else {
      X = 0.0;
      Y = 0.0;
      Z = 0.0;
    }
    vec[0] = (3.240479 * X - 1.537150 * Y - 0.498536 * Z);
    vec[1] = (-0.969256 * X + 1.875992 * Y + 0.041556 * Z);
    vec[2] = (0.055648 * X - 0.204043 * Y + 1.057311 * Z);
    for (k = 0; k < 3; k++) {
      if (vec[k] <= 0.018)
        vec[k] = 255 * 4.5 * vec[k];
      else
        vec[k] = 255 * (1.099 * pow(vec[k], 0.45) - 0.099);
      if (vec[k] > 255)
        vec[k] = 255;
      else if (vec[k] < 0)
        vec[k] = 0;
      RGB[i + k] = (unsigned char)round(vec[k]);
    }
  }
}


x86 assembly (clang, -O0):
<luv2rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  0xee2(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xecd(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xea3(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movsd  0xe7c(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x70(%rbp),%xmm1
movsd  0xe5f(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe56(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movsd  0xe37(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x70(%rbp),%xmm1
movsd  0xe1a(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    165a <luv2rgb+0x52a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    140d <luv2rgb+0x2dd>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdf9(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1270 <luv2rgb+0x140>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdee(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    12ab <luv2rgb+0x17b>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdbf(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xdab(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd5f(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd9f(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd5e(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  0xcc3(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd17(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  0xcfe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1381 <luv2rgb+0x251>
lea    0xd84(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    13a5 <luv2rgb+0x275>
jp     13a5 <luv2rgb+0x275>
lea    0xd67(%rip),%rdi
call   1030 <printf@plt>
movsd  0xcd3(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xcb4(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xc81(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1425 <luv2rgb+0x2f5>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xc96(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xc6a(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xc4d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x38(%rbp),%xmm1
movsd  0xc28(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xc13(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xbf6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x38(%rbp),%xmm1
movsd  0xbd1(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xba5(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xb88(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1647 <luv2rgb+0x517>
movslq -0x1c(%rbp),%rax
movsd  0xba3(%rip),%xmm0
ucomisd -0xa0(%rbp,%rax,8),%xmm0
ff ff
jb     1563 <luv2rgb+0x433>
movslq -0x1c(%rbp),%rax
movsd  0xbb0(%rip),%xmm0
mulsd  -0xa0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x1c(%rbp),%rax
movsd  %xmm0,-0xa0(%rbp,%rax,8)
ff ff
jmp    15b1 <luv2rgb+0x481>
movslq -0x1c(%rbp),%rax
movsd  -0xa0(%rbp,%rax,8),%xmm0
ff ff
movsd  0xb78(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xb58(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xb54(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xb38(%rip),%xmm0
mulsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rax
movsd  %xmm0,-0xa0(%rbp,%rax,8)
ff ff
movslq -0x1c(%rbp),%rax
movsd  -0xa0(%rbp,%rax,8),%xmm0
ff ff
movsd  0xb12(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15ea <luv2rgb+0x4ba>
movslq -0x1c(%rbp),%rax
movsd  0xafc(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp,%rax,8)
ff ff
jmp    1615 <luv2rgb+0x4e5>
movslq -0x1c(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd -0xa0(%rbp,%rax,8),%xmm0
ff ff
jbe    1610 <luv2rgb+0x4e0>
movslq -0x1c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp,%rax,8)
ff ff
jmp    1615 <luv2rgb+0x4e5>
movslq -0x1c(%rbp),%rax
movsd  -0xa0(%rbp,%rax,8),%xmm0
ff ff
call   1050 <round@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1517 <luv2rgb+0x3e7>
jmp    164c <luv2rgb+0x51c>
mov    -0x18(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x18(%rbp)
jmp    1201 <luv2rgb+0xd1>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<luv2rgb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
test   %edx,%edx
jle    1525 <luv2rgb+0x3f5>
mov    %edx,%r14d
mov    %rsi,%r13
mov    %rdi,%rbp
xor    %ebx,%ebx
lea    0xf9f(%rip),%r15
lea    0xf91(%rip),%r12
jmp    1186 <luv2rgb+0x56>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1050 <round@plt>
mov    %al,0x2(%rbp,%rbx,1)
add    $0x3,%rbx
cmp    %r14d,%ebx
jge    1525 <luv2rgb+0x3f5>
movss  0x0(%r13,%rbx,4),%xmm1
xorpd  %xmm3,%xmm3
ucomiss 0xe6c(%rip),%xmm1
xorpd  %xmm2,%xmm2
jbe    12d4 <luv2rgb+0x1a4>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movss  0xe4f(%rip),%xmm2
ucomiss %xmm1,%xmm2
jbe    11d0 <luv2rgb+0xa0>
movapd %xmm0,%xmm2
divsd  0xe5e(%rip),%xmm2
movsd  0xe4e(%rip),%xmm1
jmp    1204 <luv2rgb+0xd4>
nopl   0x0(%rax)
addsd  0xe30(%rip),%xmm0
divsd  0xe30(%rip),%xmm0
movsd  0xe30(%rip),%xmm1
call   1040 <pow@plt>
movsd  0xe23(%rip),%xmm1
movapd %xmm0,%xmm2
movss  0x0(%r13,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
cvtps2pd 0x4(%r13,%rbx,4),%xmm3
divpd  0xeae(%rip),%xmm3
movlhps %xmm0,%xmm0
divpd  %xmm0,%xmm3
addpd  0xeaf(%rip),%xmm3
movapd %xmm3,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xdf7(%rip),%xmm0
movapd %xmm3,0x10(%rsp)
movapd %xmm3,%xmm1
unpckhpd %xmm3,%xmm1
mulsd  0xde9(%rip),%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
movapd %xmm2,0x20(%rsp)
movapd %xmm1,(%rsp)
jbe    1277 <luv2rgb+0x147>
mov    %r15,%rdi
call   1030 <puts@plt>
movapd (%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1292 <luv2rgb+0x162>
jp     1292 <luv2rgb+0x162>
mov    %r12,%rdi
call   1030 <puts@plt>
movapd (%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
movapd 0x10(%rsp),%xmm3
mulpd  0xe40(%rip),%xmm3
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm3
movsd  0xd88(%rip),%xmm0
subsd  %xmm3,%xmm0
movapd %xmm3,%xmm1
unpckhpd %xmm3,%xmm1
subsd  %xmm1,%xmm0
unpcklpd %xmm3,%xmm0
divpd  %xmm1,%xmm0
movapd %xmm2,%xmm3
unpcklpd %xmm2,%xmm3
mulpd  %xmm0,%xmm3
movapd %xmm2,%xmm0
mulsd  0xd60(%rip),%xmm0
movapd %xmm3,%xmm4
unpckhpd %xmm3,%xmm4
movapd %xmm4,%xmm1
mulsd  0xd54(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm3,%xmm0
mulsd  0xd4c(%rip),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm2,%xmm6
mulsd  0xd44(%rip),%xmm6
movapd %xmm4,%xmm7
mulsd  0xd40(%rip),%xmm7
movapd %xmm3,%xmm5
mulsd  0xd3c(%rip),%xmm5
mulsd  0xd3c(%rip),%xmm2
mulsd  0xd3c(%rip),%xmm4
mulsd  0xd3c(%rip),%xmm3
movsd  0xd3c(%rip),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm2,0x20(%rsp)
movapd %xmm3,(%rsp)
movapd %xmm4,0x40(%rsp)
jae    13c0 <luv2rgb+0x290>
movsd  0xd2d(%rip),%xmm1
movsd  %xmm5,0x10(%rsp)
movsd  %xmm6,0x38(%rsp)
movsd  %xmm7,0x30(%rsp)
call   1040 <pow@plt>
movsd  0x30(%rsp),%xmm7
movsd  0x38(%rsp),%xmm6
movsd  0x10(%rsp),%xmm5
mulsd  0xd04(%rip),%xmm0
addsd  0xd04(%rip),%xmm0
movsd  0xd04(%rip),%xmm1
mulsd  %xmm1,%xmm0
ucomisd %xmm1,%xmm0
jbe    13d6 <luv2rgb+0x2a6>
jmp    13e8 <luv2rgb+0x2b8>
nopl   0x0(%rax,%rax,1)
mulsd  0xcc8(%rip),%xmm0
movsd  0xce0(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     13e8 <luv2rgb+0x2b8>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm0,%xmm1
jbe    13e8 <luv2rgb+0x2b8>
xorpd  %xmm1,%xmm1
addsd  %xmm6,%xmm7
addsd  %xmm7,%xmm5
movsd  %xmm5,0x10(%rsp)
movapd %xmm1,%xmm0
call   1050 <round@plt>
movsd  0x10(%rsp),%xmm4
mov    %al,0x0(%rbp,%rbx,1)
movsd  0xc77(%rip),%xmm0
ucomisd %xmm4,%xmm0
jae    1450 <luv2rgb+0x320>
movapd %xmm4,%xmm0
movsd  0xc75(%rip),%xmm1
call   1040 <pow@plt>
movapd %xmm0,%xmm4
mulsd  0xc6c(%rip),%xmm4
addsd  0xc6c(%rip),%xmm4
movsd  0xc6c(%rip),%xmm0
mulsd  %xmm0,%xmm4
jmp    1460 <luv2rgb+0x330>
nopw   0x0(%rax,%rax,1)
mulsd  0xc38(%rip),%xmm4
movsd  0xc50(%rip),%xmm0
movapd 0x20(%rsp),%xmm1
movapd (%rsp),%xmm2
movapd 0x40(%rsp),%xmm3
ucomisd %xmm0,%xmm4
ja     1489 <luv2rgb+0x359>
xorpd  %xmm0,%xmm0
ucomisd %xmm4,%xmm0
movapd %xmm4,%xmm0
jbe    1489 <luv2rgb+0x359>
xorpd  %xmm0,%xmm0
addsd  %xmm1,%xmm3
addsd  %xmm3,%xmm2
movapd %xmm2,(%rsp)
call   1050 <round@plt>
movapd (%rsp),%xmm1
mov    %al,0x1(%rbp,%rbx,1)
movsd  0xbdc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    14f0 <luv2rgb+0x3c0>
movapd %xmm1,%xmm0
movsd  0xbda(%rip),%xmm1
call   1040 <pow@plt>
movapd %xmm0,%xmm1
mulsd  0xbd1(%rip),%xmm1
addsd  0xbd1(%rip),%xmm1
movsd  0xbd1(%rip),%xmm0
mulsd  %xmm0,%xmm1
ucomisd %xmm0,%xmm1
ja     1170 <luv2rgb+0x40>
jmp    150a <luv2rgb+0x3da>
nop
mulsd  0xb98(%rip),%xmm1
movsd  0xbb0(%rip),%xmm0
ucomisd %xmm0,%xmm1
ja     1170 <luv2rgb+0x40>
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
movapd %xmm1,%xmm0
jbe    1170 <luv2rgb+0x40>
xorpd  %xmm0,%xmm0
jmp    1170 <luv2rgb+0x40>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"den<0\0A\00"
@.str.1 = [8 x i8] c"den==0\0A\00"
define void @luv2rgb(i8* %0, float* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca [3 x double]
store i8* %0, i8** %4
store float* %1, float** %5
store i32 %2, i32* %6
store double 0x3FEF6C8B43958106, double* %17
store double 0x3FEFFFFFFFFFFFFF, double* %19
store double 1.183000e+00, double* %18
%23 = load double, double* %17
%24 = fmul double 4.000000e+00, %23
%25 = load double, double* %17
%26 = load double, double* %19
%27 = call double @llvm.fmuladd.f64(double 1.500000e+01, double %26, double %25)
%28 = load double, double* %18
%29 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %28, double %27)
%30 = fdiv double %24, %29
store double %30, double* %20
%31 = load double, double* %19
%32 = fmul double 9.000000e+00, %31
%33 = load double, double* %17
%34 = load double, double* %19
%35 = call double @llvm.fmuladd.f64(double 1.500000e+01, double %34, double %33)
%36 = load double, double* %18
%37 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %36, double %35)
%38 = fdiv double %32, %37
store double %38, double* %21
store i32 0, i32* %7
br label %39
39: ; preds = %238, %3
%40 = load i32, i32* %7
%41 = load i32, i32* %6
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %241
43: ; preds = %39
%44 = load float*, float** %5
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds float, float* %44, i64 %46
%48 = load float, float* %47
%49 = fcmp ogt float %48, 0.000000e+00
br i1 %49, label %50, label %146
50: ; preds = %43
%51 = load float*, float** %5
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds float, float* %51, i64 %53
%55 = load float, float* %54
%56 = fpext float %55 to double
%57 = fcmp olt double %56, 8.000000e+00
br i1 %57, label %58, label %66
58: ; preds = %50
%59 = load float*, float** %5
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %59, i64 %61
%63 = load float, float* %62
%64 = fpext float %63 to double
%65 = fdiv double %64, 0x408C3A6666666666
store double %65, double* %12
br label %76
66: ; preds = %50
%67 = load float*, float** %5
%68 = load i32, i32* %7
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds float, float* %67, i64 %69
%71 = load float, float* %70
%72 = fpext float %71 to double
%73 = fadd double %72, 1.600000e+01
%74 = fdiv double %73, 1.160000e+02
%75 = call double @pow(double %74, double 3.000000e+00)
store double %75, double* %12
br label %76
76: ; preds = %66, %58
%77 = load float*, float** %5
%78 = load i32, i32* %7
%79 = add nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds float, float* %77, i64 %80
%82 = load float, float* %81
%83 = fpext float %82 to double
%84 = fdiv double %83, 1.300000e+01
%85 = load float*, float** %5
%86 = load i32, i32* %7
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds float, float* %85, i64 %87
%89 = load float, float* %88
%90 = fpext float %89 to double
%91 = fdiv double %84, %90
%92 = load double, double* %20
%93 = fadd double %91, %92
store double %93, double* %15
%94 = load float*, float** %5
%95 = load i32, i32* %7
%96 = add nsw i32 %95, 2
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds float, float* %94, i64 %97
%99 = load float, float* %98
%100 = fpext float %99 to double
%101 = fdiv double %100, 1.300000e+01
%102 = load float*, float** %5
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds float, float* %102, i64 %104
%106 = load float, float* %105
%107 = fpext float %106 to double
%108 = fdiv double %101, %107
%109 = load double, double* %21
%110 = fadd double %108, %109
store double %110, double* %16
%111 = load double, double* %15
%112 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %111, double 6.000000e+00)
%113 = load double, double* %16
%114 = call double @llvm.fmuladd.f64(double -8.000000e+00, double %113, double %112)
store double %114, double* %14
%115 = load double, double* %14
%116 = fcmp olt double %115, 0.000000e+00
br i1 %116, label %117, label %119
117: ; preds = %76
%118 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %119
119: ; preds = %117, %76
%120 = load double, double* %14
%121 = fcmp oeq double %120, 0.000000e+00
br i1 %121, label %122, label %124
122: ; preds = %119
%123 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %124
124: ; preds = %122, %119
%125 = load double, double* %15
%126 = fmul double 4.500000e+00, %125
%127 = load double, double* %14
%128 = fdiv double %126, %127
store double %128, double* %9
%129 = load double, double* %16
%130 = fmul double 2.000000e+00, %129
%131 = load double, double* %14
%132 = fdiv double %130, %131
store double %132, double* %10
%133 = load double, double* %9
%134 = load double, double* %10
%135 = fdiv double %133, %134
%136 = load double, double* %12
%137 = fmul double %135, %136
store double %137, double* %11
%138 = load double, double* %9
%139 = fsub double 1.000000e+00, %138
%140 = load double, double* %10
%141 = fsub double %139, %140
%142 = load double, double* %10
%143 = fdiv double %141, %142
%144 = load double, double* %12
%145 = fmul double %143, %144
store double %145, double* %13
br label %147
146: ; preds = %43
store double 0.000000e+00, double* %11
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %13
br label %147
147: ; preds = %146, %124
%148 = load double, double* %11
%149 = load double, double* %12
%150 = fmul double 1.537150e+00, %149
%151 = fneg double %150
%152 = call double @llvm.fmuladd.f64(double 0x4009EC804102FF8F, double %148, double %151)
%153 = load double, double* %13
%154 = call double @llvm.fmuladd.f64(double -4.985360e-01, double %153, double %152)
%155 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
store double %154, double* %155
%156 = load double, double* %11
%157 = load double, double* %12
%158 = fmul double 0x3FFE04102FF8EC10, %157
%159 = call double @llvm.fmuladd.f64(double -9.692560e-01, double %156, double %158)
%160 = load double, double* %13
%161 = call double @llvm.fmuladd.f64(double 4.155600e-02, double %160, double %159)
%162 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
store double %161, double* %162
%163 = load double, double* %11
%164 = load double, double* %12
%165 = fmul double 2.040430e-01, %164
%166 = fneg double %165
%167 = call double @llvm.fmuladd.f64(double 5.564800e-02, double %163, double %166)
%168 = load double, double* %13
%169 = call double @llvm.fmuladd.f64(double 0x3FF0EABEF06B3786, double %168, double %167)
%170 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double %169, double* %170
store i32 0, i32* %8
br label %171
171: ; preds = %234, %147
%172 = load i32, i32* %8
%173 = icmp slt i32 %172, 3
br i1 %173, label %174, label %237
174: ; preds = %171
%175 = load i32, i32* %8
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %176
%178 = load double, double* %177
%179 = fcmp ole double %178, 1.800000e-02
br i1 %179, label %180, label %189
180: ; preds = %174
%181 = load i32, i32* %8
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %182
%184 = load double, double* %183
%185 = fmul double 1.147500e+03, %184
%186 = load i32, i32* %8
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %187
store double %185, double* %188
br label %200
189: ; preds = %174
%190 = load i32, i32* %8
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %191
%193 = load double, double* %192
%194 = call double @pow(double %193, double 4.500000e-01)
%195 = call double @llvm.fmuladd.f64(double 1.099000e+00, double %194, double -9.900000e-02)
%196 = fmul double 2.550000e+02, %195
%197 = load i32, i32* %8
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %198
store double %196, double* %199
br label %200
200: ; preds = %189, %180
%201 = load i32, i32* %8
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %202
%204 = load double, double* %203
%205 = fcmp ogt double %204, 2.550000e+02
br i1 %205, label %206, label %210
206: ; preds = %200
%207 = load i32, i32* %8
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %208
store double 2.550000e+02, double* %209
br label %221
210: ; preds = %200
%211 = load i32, i32* %8
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %212
%214 = load double, double* %213
%215 = fcmp olt double %214, 0.000000e+00
br i1 %215, label %216, label %220
216: ; preds = %210
%217 = load i32, i32* %8
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %218
store double 0.000000e+00, double* %219
br label %220
220: ; preds = %216, %210
br label %221
221: ; preds = %220, %206
%222 = load i32, i32* %8
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 %223
%225 = load double, double* %224
%226 = call i64 @round(double %225)
%227 = trunc i64 %226 to i8
%228 = load i8*, i8** %4
%229 = load i32, i32* %7
%230 = load i32, i32* %8
%231 = add nsw i32 %229, %230
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds i8, i8* %228, i64 %232
store i8 %227, i8* %233
br label %234
234: ; preds = %221
%235 = load i32, i32* %8
%236 = add nsw i32 %235, 1
store i32 %236, i32* %8
br label %171
237: ; preds = %171
br label %238
238: ; preds = %237
%239 = load i32, i32* %7
%240 = add nsw i32 %239, 3
store i32 %240, i32* %7
br label %39
241: ; preds = %39
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"den==0\00"
@str.2 = [6 x i8] c"den<0\00"
define void @luv2rgb(i8* nocapture writeonly %0, float* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %134
5: ; preds = %3, %125
%6 = phi i64 [ %131, %125 ], [ 0, %3 ]
%7 = getelementptr inbounds float, float* %1, i64 %6
%8 = load float, float* %7
%9 = fcmp ogt float %8, 0.000000e+00
br i1 %9, label %10, label %61
10: ; preds = %5
%11 = fpext float %8 to double
%12 = fcmp olt float %8, 8.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = fdiv double %11, 0x408C3A6666666666
br label %21
15: ; preds = %10
%16 = fadd double %11, 1.600000e+01
%17 = fdiv double %16, 1.160000e+02
%18 = tail call double @pow(double %17, double 3.000000e+00)
%19 = load float, float* %7
%20 = fpext float %19 to double
br label %21
21: ; preds = %15, %13
%22 = phi double [ %20, %15 ], [ %11, %13 ]
%23 = phi double [ %18, %15 ], [ %14, %13 ]
%24 = add nuw nsw i64 %6, 1
%25 = getelementptr inbounds float, float* %1, i64 %24
%26 = bitcast float* %25 to <2 x float>*
%27 = load <2 x float>, <2 x float>* %26
%28 = fpext <2 x float> %27 to <2 x double>
%29 = fdiv <2 x double> %28, <double 1.300000e+01, double 1.300000e+01>
%30 = insertelement <2 x double> poison, double %22, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
%32 = fdiv <2 x double> %29, %31
%33 = fadd <2 x double> %32, <double 0x3FC9BE2CBFA13520, double 0x3FDD7DD805C469F5>
%34 = extractelement <2 x double> %33, i64 0
%35 = tail call double @llvm.fmuladd.f64(double %34, double 3.000000e+00, double 6.000000e+00)
%36 = extractelement <2 x double> %33, i64 1
%37 = tail call double @llvm.fmuladd.f64(double %36, double -8.000000e+00, double %35)
%38 = fcmp olt double %37, 0.000000e+00
br i1 %38, label %39, label %41
39: ; preds = %21
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.2, i64 0, i64 0))
br label %41
41: ; preds = %39, %21
%42 = fcmp oeq double %37, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %41
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
%46 = fmul <2 x double> %33, <double 4.500000e+00, double 2.000000e+00>
%47 = insertelement <2 x double> poison, double %37, i64 0
%48 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> zeroinitializer
%49 = fdiv <2 x double> %46, %48
%50 = extractelement <2 x double> %49, i64 0
%51 = fsub double 1.000000e+00, %50
%52 = extractelement <2 x double> %49, i64 1
%53 = fsub double %51, %52
%54 = insertelement <2 x double> poison, double %53, i64 0
%55 = shufflevector <2 x double> %54, <2 x double> %49, <2 x i32> <i32 0, i32 2>
%56 = shufflevector <2 x double> %49, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%57 = fdiv <2 x double> %55, %56
%58 = insertelement <2 x double> poison, double %23, i64 0
%59 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> zeroinitializer
%60 = fmul <2 x double> %59, %57
br label %61
61: ; preds = %5, %45
%62 = phi double [ %23, %45 ], [ 0.000000e+00, %5 ]
%63 = phi <2 x double> [ %60, %45 ], [ zeroinitializer, %5 ]
%64 = fmul double %62, -1.537150e+00
%65 = extractelement <2 x double> %63, i64 1
%66 = tail call double @llvm.fmuladd.f64(double %65, double 0x4009EC804102FF8F, double %64)
%67 = extractelement <2 x double> %63, i64 0
%68 = tail call double @llvm.fmuladd.f64(double %67, double -4.985360e-01, double %66)
%69 = fmul double %62, 0x3FFE04102FF8EC10
%70 = tail call double @llvm.fmuladd.f64(double %65, double -9.692560e-01, double %69)
%71 = tail call double @llvm.fmuladd.f64(double %67, double 4.155600e-02, double %70)
%72 = fmul double %62, -2.040430e-01
%73 = tail call double @llvm.fmuladd.f64(double %65, double 5.564800e-02, double %72)
%74 = tail call double @llvm.fmuladd.f64(double %67, double 0x3FF0EABEF06B3786, double %73)
%75 = fcmp ugt double %68, 1.800000e-02
br i1 %75, label %78, label %76
76: ; preds = %61
%77 = fmul double %68, 1.147500e+03
br label %82
78: ; preds = %61
%79 = tail call double @pow(double %68, double 4.500000e-01)
%80 = tail call double @llvm.fmuladd.f64(double %79, double 1.099000e+00, double -9.900000e-02)
%81 = fmul double %80, 2.550000e+02
br label %82
82: ; preds = %78, %76
%83 = phi double [ %81, %78 ], [ %77, %76 ]
%84 = fcmp ogt double %83, 2.550000e+02
br i1 %84, label %88, label %85
85: ; preds = %82
%86 = fcmp olt double %83, 0.000000e+00
br i1 %86, label %87, label %88
87: ; preds = %85
br label %88
88: ; preds = %82, %85, %87
%89 = phi double [ 0.000000e+00, %87 ], [ %83, %85 ], [ 2.550000e+02, %82 ]
%90 = tail call i64 @round(double %89)
%91 = trunc i64 %90 to i8
%92 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %91, i8* %92
%93 = fcmp ugt double %71, 1.800000e-02
br i1 %93, label %96, label %94
94: ; preds = %88
%95 = fmul double %71, 1.147500e+03
br label %100
96: ; preds = %88
%97 = tail call double @pow(double %71, double 4.500000e-01)
%98 = tail call double @llvm.fmuladd.f64(double %97, double 1.099000e+00, double -9.900000e-02)
%99 = fmul double %98, 2.550000e+02
br label %100
100: ; preds = %96, %94
%101 = phi double [ %99, %96 ], [ %95, %94 ]
%102 = fcmp ogt double %101, 2.550000e+02
br i1 %102, label %106, label %103
103: ; preds = %100
%104 = fcmp olt double %101, 0.000000e+00
br i1 %104, label %105, label %106
105: ; preds = %103
br label %106
106: ; preds = %100, %105, %103
%107 = phi double [ 0.000000e+00, %105 ], [ %101, %103 ], [ 2.550000e+02, %100 ]
%108 = tail call i64 @round(double %107)
%109 = trunc i64 %108 to i8
%110 = add nuw nsw i64 %6, 1
%111 = getelementptr inbounds i8, i8* %0, i64 %110
store i8 %109, i8* %111
%112 = fcmp ugt double %74, 1.800000e-02
br i1 %112, label %115, label %113
113: ; preds = %106
%114 = fmul double %74, 1.147500e+03
br label %119
115: ; preds = %106
%116 = tail call double @pow(double %74, double 4.500000e-01)
%117 = tail call double @llvm.fmuladd.f64(double %116, double 1.099000e+00, double -9.900000e-02)
%118 = fmul double %117, 2.550000e+02
br label %119
119: ; preds = %115, %113
%120 = phi double [ %118, %115 ], [ %114, %113 ]
%121 = fcmp ogt double %120, 2.550000e+02
br i1 %121, label %125, label %122
122: ; preds = %119
%123 = fcmp olt double %120, 0.000000e+00
br i1 %123, label %124, label %125
124: ; preds = %122
br label %125
125: ; preds = %119, %124, %122
%126 = phi double [ 0.000000e+00, %124 ], [ %120, %122 ], [ 2.550000e+02, %119 ]
%127 = tail call i64 @round(double %126)
%128 = trunc i64 %127 to i8
%129 = add nuw nsw i64 %6, 2
%130 = getelementptr inbounds i8, i8* %0, i64 %129
store i8 %128, i8* %130
%131 = add nuw i64 %6, 3
%132 = trunc i64 %131 to i32
%133 = icmp slt i32 %132, %2
br i1 %133, label %5, label %134
134: ; preds = %125, %3
ret void
}