#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 */
typedef int uint8_t;

/* Variables and functions */
uint8_t R(double T) {
  if (T >= -1.0) {
    if (T <= 0.0)
      return 255 * (1);
    if (T <= 1.0)
      return 255 * (-0.990 * T * T * T + 2.34 * T * T - 1.99 * T + 0.970);
  }
  return 0;
}


x86 assembly (clang, -O0):
<R>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11bc <R+0xbc>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     113a <R+0x3a>
movl   $0xff,-0x4(%rbp)
jmp    11c3 <R+0xc3>
movsd  0xec6(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11b7 <R+0xb7>
movsd  0xedb(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  0xebc(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe95(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe7d(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe69(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    11c3 <R+0xc3>
jmp    11bc <R+0xbc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<R>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
jb     1176 <R+0x76>
mov    $0xff,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1176 <R+0x76>
movsd  0xee5(%rip),%xmm1
ucomisd %xmm0,%xmm1
mov    $0x0,%eax
jb     1176 <R+0x76>
movsd  0xeda(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xed2(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
mulsd  0xec6(%rip),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
addsd  0xebe(%rip),%xmm0
mulsd  0xebe(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @R(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, -1.000000e+00
br i1 %5, label %6, label %30
6: ; preds = %1
%7 = load double, double* %3
%8 = fcmp ole double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 255, i32* %2
br label %31
10: ; preds = %6
%11 = load double, double* %3
%12 = fcmp ole double %11, 1.000000e+00
br i1 %12, label %13, label %29
13: ; preds = %10
%14 = load double, double* %3
%15 = fmul double 0xBFEFAE147AE147AE, %14
%16 = load double, double* %3
%17 = fmul double %15, %16
%18 = load double, double* %3
%19 = load double, double* %3
%20 = fmul double 2.340000e+00, %19
%21 = load double, double* %3
%22 = fmul double %20, %21
%23 = call double @llvm.fmuladd.f64(double %17, double %18, double %22)
%24 = load double, double* %3
%25 = call double @llvm.fmuladd.f64(double -1.990000e+00, double %24, double %23)
%26 = fadd double %25, 0x3FEF0A3D70A3D70A
%27 = fmul double 2.550000e+02, %26
%28 = fptosi double %27 to i32
store i32 %28, i32* %2
br label %31
29: ; preds = %10
br label %30
30: ; preds = %29, %1
store i32 0, i32* %2
br label %31
31: ; preds = %30, %13, %9
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @R(double %0) {
%2 = fcmp ult double %0, -1.000000e+00
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = fcmp ugt double %0, 0.000000e+00
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = fcmp ugt double %0, 1.000000e+00
br i1 %6, label %17, label %7
7: ; preds = %5
%8 = fmul double %0, 0xBFEFAE147AE147AE
%9 = fmul double %8, %0
%10 = fmul double %0, 2.340000e+00
%11 = fmul double %10, %0
%12 = tail call double @llvm.fmuladd.f64(double %9, double %0, double %11)
%13 = tail call double @llvm.fmuladd.f64(double %0, double -1.990000e+00, double %12)
%14 = fadd double %13, 0x3FEF0A3D70A3D70A
%15 = fmul double %14, 2.550000e+02
%16 = fptosi double %15 to i32
br label %17
17: ; preds = %1, %5, %3, %7
%18 = phi i32 [ %16, %7 ], [ 255, %3 ], [ 0, %5 ], [ 0, %1 ]
ret i32 %18
}