#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 log10(double);
void plotdatacolor(char colorscheme, double x, int *r, int *g, int *b) {
  int red = 0, green = 0, blue = 0;
  double col[4];
  if (colorscheme == 0) {
    col[0] = 100.0;
    col[1] = 600.0;
    col[2] = 1200.0;
    col[3] = 5000.0;
    red = 255 - ((int)(x * 255.0 / col[0]));
    if (red < 0)
      red = 0;
    if (x < col[1])
      green = 255 - (int)(255.0 * (col[1] - x) / (col[1] - col[0]));
    else
      green = 255 - (int)(255.0 * (x - col[1]) / (col[2] - col[1]));
    if (green < 0)
      green = 0;
    blue = 255 - (int)(255.0 * (col[3] - x) / (col[3] - col[2]));
    if (blue < 0)
      blue = 0;
    if (blue > 255)
      blue = 255;
  } else if (colorscheme == 1) {
    col[0] = 2;
    col[1] = 30;
    if (x * col[0] < 255)
      red = (int)(255.0 - x * col[0]);
    else
      green = (int)(col[1] * log10(col[0] * x - 250));
    if (red < 0)
      red = 0;
    if (red > 255)
      red = 255;
    if (green < 0)
      green = 0;
    if (green > 255)
      green = 255;
  }
  *r = red;
  *g = green;
  *b = blue;
}


x86 assembly (clang, -O0):
<plotdatacolor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    12a0 <plotdatacolor+0x190>
movsd  0xedf(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe73(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
cvttsd2si %xmm0,%ecx
mov    $0xff,%eax
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    11b6 <plotdatacolor+0xa6>
movl   $0x0,-0x2c(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1201 <plotdatacolor+0xf1>
movsd  -0x58(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xe24(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    $0xff,%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
jmp    1233 <plotdatacolor+0x123>
movsd  -0x10(%rbp),%xmm1
subsd  -0x58(%rbp),%xmm1
movsd  0xded(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
subsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    $0xff,%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    1244 <plotdatacolor+0x134>
movl   $0x0,-0x30(%rbp)
movsd  -0x48(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xdaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  -0x50(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    $0xff,%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1287 <plotdatacolor+0x177>
movl   $0x0,-0x34(%rbp)
cmpl   $0xff,-0x34(%rbp)
jle    129b <plotdatacolor+0x18b>
movl   $0xff,-0x34(%rbp)
jmp    13b0 <plotdatacolor+0x2a0>
movsbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    13ab <plotdatacolor+0x29b>
movsd  0xd5b(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xd46(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movsd  0xd27(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1320 <plotdatacolor+0x210>
movsd  -0x10(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xcf0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
jmp    135c <plotdatacolor+0x24c>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcd8(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    136d <plotdatacolor+0x25d>
movl   $0x0,-0x2c(%rbp)
cmpl   $0xff,-0x2c(%rbp)
jle    1381 <plotdatacolor+0x271>
movl   $0xff,-0x2c(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    1392 <plotdatacolor+0x282>
movl   $0x0,-0x30(%rbp)
cmpl   $0xff,-0x30(%rbp)
jle    13a6 <plotdatacolor+0x296>
movl   $0xff,-0x30(%rbp)
jmp    13ab <plotdatacolor+0x29b>
jmp    13b0 <plotdatacolor+0x2a0>
mov    -0x2c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plotdatacolor>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
xor    %ebp,%ebp
cmp    $0x1,%dil
je     1156 <plotdatacolor+0x46>
pxor   %xmm1,%xmm1
test   %dil,%dil
jne    1259 <plotdatacolor+0x149>
movsd  0xedb(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %cl
ja     1192 <plotdatacolor+0x82>
movsd  0xed0(%rip),%xmm1
addsd  %xmm0,%xmm1
jmp    1196 <plotdatacolor+0x86>
addsd  %xmm0,%xmm0
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    121c <plotdatacolor+0x10c>
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
test   %eax,%eax
jle    124b <plotdatacolor+0x13b>
cmp    $0xff,%eax
mov    $0xff,%ecx
cmovb  %eax,%ecx
movd   %ecx,%xmm1
jmp    1259 <plotdatacolor+0x149>
subsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm1,%xmm2
mulpd  0xeaa(%rip),%xmm2
movapd 0xeb2(%rip),%xmm1
mov    %cl,%al
lea    0xeb9(%rip),%rcx
movhpd (%rcx,%rax,8),%xmm1
divpd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm1
movdqa 0xeb4(%rip),%xmm2
psubd  %xmm1,%xmm2
pxor   %xmm3,%xmm3
movdqa %xmm2,%xmm1
pcmpgtd %xmm3,%xmm1
movsd  0xe44(%rip),%xmm3
subsd  %xmm0,%xmm3
mulsd  0xe10(%rip),%xmm3
divsd  0xe38(%rip),%xmm3
pand   %xmm2,%xmm1
cvttsd2si %xmm3,%eax
xor    %ecx,%ecx
mov    $0xff,%ebp
sub    %eax,%ebp
cmovs  %ecx,%ebp
mov    $0xff,%eax
cmp    $0xff,%ebp
cmovae %eax,%ebp
jmp    1259 <plotdatacolor+0x149>
addsd  0xde4(%rip),%xmm0
call   1030 <log10@plt>
mulsd  0xddf(%rip),%xmm0
cvttsd2si %xmm0,%eax
test   %eax,%eax
jle    124b <plotdatacolor+0x13b>
cmp    $0xfe,%eax
ja     1251 <plotdatacolor+0x141>
movd   %eax,%xmm0
pshufd $0x51,%xmm0,%xmm1
jmp    1259 <plotdatacolor+0x149>
xorpd  %xmm1,%xmm1
jmp    1259 <plotdatacolor+0x149>
movdqa 0xde7(%rip),%xmm1
movd   %xmm1,(%rbx)
pshufd $0x55,%xmm1,%xmm0
movd   %xmm0,(%r15)
mov    %ebp,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @plotdatacolor(i8 signext %0, double %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
switch i8 %0, label %53 [
i8 0, label %6
i8 1, label %30
]
6: ; preds = %5
%7 = fcmp olt double %1, 6.000000e+02
%8 = fadd double %1, -6.000000e+02
%9 = fsub double 6.000000e+02, %1
%10 = select i1 %7, double %9, double %8
%11 = select i1 %7, double 5.000000e+02, double 6.000000e+02
%12 = insertelement <2 x double> poison, double %1, i64 0
%13 = insertelement <2 x double> %12, double %10, i64 1
%14 = fmul <2 x double> %13, <double 2.550000e+02, double 2.550000e+02>
%15 = insertelement <2 x double> <double 1.000000e+02, double poison>, double %11, i64 1
%16 = fdiv <2 x double> %14, %15
%17 = fptosi <2 x double> %16 to <2 x i32>
%18 = sub nsw <2 x i32> <i32 255, i32 255>, %17
%19 = icmp sgt <2 x i32> %18, zeroinitializer
%20 = select <2 x i1> %19, <2 x i32> %18, <2 x i32> zeroinitializer
%21 = fsub double 5.000000e+03, %1
%22 = fmul double %21, 2.550000e+02
%23 = fdiv double %22, 3.800000e+03
%24 = fptosi double %23 to i32
%25 = sub nsw i32 255, %24
%26 = icmp sgt i32 %25, 0
%27 = select i1 %26, i32 %25, i32 0
%28 = icmp ult i32 %27, 255
%29 = select i1 %28, i32 %27, i32 255
br label %53
30: ; preds = %5
%31 = fmul double %1, 2.000000e+00
%32 = fcmp olt double %31, 2.550000e+02
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = fneg double %1
%35 = tail call double @llvm.fmuladd.f64(double %34, double 2.000000e+00, double 2.550000e+02)
%36 = fptosi double %35 to i32
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %51
38: ; preds = %33
%39 = icmp ult i32 %36, 255
%40 = select i1 %39, i32 %36, i32 255
%41 = insertelement <2 x i32> <i32 poison, i32 0>, i32 %40, i64 0
br label %51
42: ; preds = %30
%43 = tail call double @llvm.fmuladd.f64(double %1, double 2.000000e+00, double -2.500000e+02)
%44 = tail call double @log10(double %43)
%45 = fmul double %44, 3.000000e+01
%46 = fptosi double %45 to i32
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %42
%49 = icmp ult i32 %46, 255
%50 = insertelement <2 x i32> <i32 0, i32 poison>, i32 %46, i64 1
br i1 %49, label %51, label %53
51: ; preds = %38, %33, %42, %48
%52 = phi <2 x i32> [ %50, %48 ], [ zeroinitializer, %42 ], [ zeroinitializer, %33 ], [ %41, %38 ]
br label %53
53: ; preds = %51, %48, %5, %6
%54 = phi i32 [ %29, %6 ], [ 0, %5 ], [ 0, %48 ], [ 0, %51 ]
%55 = phi <2 x i32> [ %20, %6 ], [ zeroinitializer, %5 ], [ <i32 0, i32 255>, %48 ], [ %52, %51 ]
%56 = extractelement <2 x i32> %55, i64 0
store i32 %56, i32* %2
%57 = extractelement <2 x i32> %55, i64 1
store i32 %57, i32* %3
store i32 %54, i32* %4
ret void
}