#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 */
int /*<<< orphan*/ error2(char *);
scalar_t__ fabs(double);
void rainbowRGB(double temperature, int *R, int *G, int *B) {
  double T = temperature, maxT = 1;
  if (T > maxT)
    error2("temperature rescaling needed.");
  *R = (int)fabs(-5157.3 * T * T * T * T + 9681.4 * T * T * T - 5491.9 * T * T +
                 1137.7 * T + 6.2168);
  *G = (int)fabs(-1181.4 * T * T * T + 964.8 * T * T + 203.66 * T + 1.2028);
  *B = (int)fabs(92.463 * T * T * T - 595.92 * T * T + 481.11 * T + 21.769);
  if (*R > 255)
    *R = 255;
  if (*G > 255)
    *G = 255;
  if (*B > 255)
    *B = 255;
}


x86 assembly (clang, -O0):
<rainbowRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    116c <rainbowRGB+0x4c>
lea    0xf09(%rip),%rdi
call   1030 <error2@plt>
movsd  0xef4(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xed0(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xea9(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xe6b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe53(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <fabs@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  0xe32(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  0xe13(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xdec(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdd4(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <fabs@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movsd  0xdb3(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  0xd94(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xd56(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd3e(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <fabs@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0xff,(%rax)
jle    12f5 <rainbowRGB+0x1d5>
mov    -0x10(%rbp),%rax
movl   $0xff,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xff,(%rax)
jle    130f <rainbowRGB+0x1ef>
mov    -0x18(%rbp),%rax
movl   $0xff,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0xff,(%rax)
jle    1329 <rainbowRGB+0x209>
mov    -0x20(%rbp),%rax
movl   $0xff,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rainbowRGB>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
ucomisd 0xec0(%rip),%xmm0
jbe    114e <rainbowRGB+0x2e>
lea    0xf27(%rip),%rdi
call   1030 <error2@plt>
movsd  0xeb2(%rip),%xmm0
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe8c(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe80(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  0xe78(%rip),%xmm0
call   1040 <fabs@plt>
mov    %eax,(%rbx)
movsd  0xe71(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe63(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe53(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  0xe4b(%rip),%xmm0
call   1040 <fabs@plt>
mov    %eax,(%r15)
movsd  0xe43(%rip),%xmm0
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xe35(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm0
mulsd  0xe29(%rip),%xmm2
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
addsd  0xe21(%rip),%xmm2
movapd %xmm2,%xmm0
call   1040 <fabs@plt>
mov    %eax,(%r14)
cmpl   $0x100,(%rbx)
jge    127e <rainbowRGB+0x15e>
cmpl   $0x100,(%r15)
jge    128d <rainbowRGB+0x16d>
cmpl   $0x100,(%r14)
jl     1274 <rainbowRGB+0x154>
movl   $0xff,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
movl   $0xff,(%rbx)
cmpl   $0x100,(%r15)
jl     1264 <rainbowRGB+0x144>
movl   $0xff,(%r15)
cmpl   $0x100,(%r14)
jge    126d <rainbowRGB+0x14d>
jmp    1274 <rainbowRGB+0x154>

LLVM IR (-O0):
@.str = [30 x i8] c"temperature rescaling needed.\00"
define void @rainbowRGB(double %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca double
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%11 = load double, double* %5
store double %11, double* %9
store double 1.000000e+00, double* %10
%12 = load double, double* %9
%13 = load double, double* %10
%14 = fcmp ogt double %12, %13
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = call i32 @error2(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %4
%18 = load double, double* %9
%19 = fmul double -5.157300e+03, %18
%20 = load double, double* %9
%21 = fmul double %19, %20
%22 = load double, double* %9
%23 = fmul double %21, %22
%24 = load double, double* %9
%25 = load double, double* %9
%26 = fmul double 0x40C2E8B333333333, %25
%27 = load double, double* %9
%28 = fmul double %26, %27
%29 = load double, double* %9
%30 = fmul double %28, %29
%31 = call double @llvm.fmuladd.f64(double %23, double %24, double %30)
%32 = load double, double* %9
%33 = fmul double 5.491900e+03, %32
%34 = load double, double* %9
%35 = fneg double %33
%36 = call double @llvm.fmuladd.f64(double %35, double %34, double %31)
%37 = load double, double* %9
%38 = call double @llvm.fmuladd.f64(double 1.137700e+03, double %37, double %36)
%39 = fadd double %38, 6.216800e+00
%40 = call i64 @fabs(double %39)
%41 = trunc i64 %40 to i32
%42 = load i32*, i32** %6
store i32 %41, i32* %42
%43 = load double, double* %9
%44 = fmul double -1.181400e+03, %43
%45 = load double, double* %9
%46 = fmul double %44, %45
%47 = load double, double* %9
%48 = load double, double* %9
%49 = fmul double 0x408E266666666666, %48
%50 = load double, double* %9
%51 = fmul double %49, %50
%52 = call double @llvm.fmuladd.f64(double %46, double %47, double %51)
%53 = load double, double* %9
%54 = call double @llvm.fmuladd.f64(double 2.036600e+02, double %53, double %52)
%55 = fadd double %54, 1.202800e+00
%56 = call i64 @fabs(double %55)
%57 = trunc i64 %56 to i32
%58 = load i32*, i32** %7
store i32 %57, i32* %58
%59 = load double, double* %9
%60 = fmul double 0x40571DA1CAC08312, %59
%61 = load double, double* %9
%62 = fmul double %60, %61
%63 = load double, double* %9
%64 = load double, double* %9
%65 = fmul double 0x40829F5C28F5C28F, %64
%66 = load double, double* %9
%67 = fmul double %65, %66
%68 = fneg double %67
%69 = call double @llvm.fmuladd.f64(double %62, double %63, double %68)
%70 = load double, double* %9
%71 = call double @llvm.fmuladd.f64(double 4.811100e+02, double %70, double %69)
%72 = fadd double %71, 2.176900e+01
%73 = call i64 @fabs(double %72)
%74 = trunc i64 %73 to i32
%75 = load i32*, i32** %8
store i32 %74, i32* %75
%76 = load i32*, i32** %6
%77 = load i32, i32* %76
%78 = icmp sgt i32 %77, 255
br i1 %78, label %79, label %81
79: ; preds = %17
%80 = load i32*, i32** %6
store i32 255, i32* %80
br label %81
81: ; preds = %79, %17
%82 = load i32*, i32** %7
%83 = load i32, i32* %82
%84 = icmp sgt i32 %83, 255
br i1 %84, label %85, label %87
85: ; preds = %81
%86 = load i32*, i32** %7
store i32 255, i32* %86
br label %87
87: ; preds = %85, %81
%88 = load i32*, i32** %8
%89 = load i32, i32* %88
%90 = icmp sgt i32 %89, 255
br i1 %90, label %91, label %93
91: ; preds = %87
%92 = load i32*, i32** %8
store i32 255, i32* %92
br label %93
93: ; preds = %91, %87
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"temperature rescaling needed.\00"
define void @rainbowRGB(double %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = fcmp ogt double %0, 1.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @error2(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = fmul double %0, -5.157300e+03
%10 = fmul double %9, %0
%11 = fmul double %10, %0
%12 = fmul double %0, 0x40C2E8B333333333
%13 = fmul double %12, %0
%14 = fmul double %13, %0
%15 = tail call double @llvm.fmuladd.f64(double %11, double %0, double %14)
%16 = fmul double %0, -5.491900e+03
%17 = tail call double @llvm.fmuladd.f64(double %16, double %0, double %15)
%18 = tail call double @llvm.fmuladd.f64(double %0, double 1.137700e+03, double %17)
%19 = fadd double %18, 6.216800e+00
%20 = tail call i64 @fabs(double %19)
%21 = trunc i64 %20 to i32
store i32 %21, i32* %1
%22 = fmul double %0, -1.181400e+03
%23 = fmul double %22, %0
%24 = fmul double %0, 0x408E266666666666
%25 = fmul double %24, %0
%26 = tail call double @llvm.fmuladd.f64(double %23, double %0, double %25)
%27 = tail call double @llvm.fmuladd.f64(double %0, double 2.036600e+02, double %26)
%28 = fadd double %27, 1.202800e+00
%29 = tail call i64 @fabs(double %28)
%30 = trunc i64 %29 to i32
store i32 %30, i32* %2
%31 = fmul double %0, 0x40571DA1CAC08312
%32 = fmul double %31, %0
%33 = fmul double %0, 0xC0829F5C28F5C28F
%34 = fmul double %33, %0
%35 = tail call double @llvm.fmuladd.f64(double %32, double %0, double %34)
%36 = tail call double @llvm.fmuladd.f64(double %0, double 4.811100e+02, double %35)
%37 = fadd double %36, 2.176900e+01
%38 = tail call i64 @fabs(double %37)
%39 = trunc i64 %38 to i32
store i32 %39, i32* %3
%40 = load i32, i32* %1
%41 = icmp sgt i32 %40, 255
br i1 %41, label %42, label %43
42: ; preds = %8
store i32 255, i32* %1
br label %43
43: ; preds = %42, %8
%44 = load i32, i32* %2
%45 = icmp sgt i32 %44, 255
br i1 %45, label %46, label %47
46: ; preds = %43
store i32 255, i32* %2
br label %47
47: ; preds = %46, %43
%48 = load i32, i32* %3
%49 = icmp sgt i32 %48, 255
br i1 %49, label %50, label %51
50: ; preds = %47
store i32 255, i32* %3
br label %51
51: ; preds = %50, %47
ret void
}