void backLightTemp(float temperature, unsigned char *red, unsigned char *green,
                   unsigned char *blue) {
  float myTemp;
  myTemp = (int)temperature;
  if (myTemp < 67.0f)
    myTemp = 67.0f;
  if (myTemp > 83.0f)
    myTemp = 83.0f;
  myTemp = myTemp - 67.0f;
  *blue = (unsigned char)(255.0f / (83.0f - 67.0f) * myTemp);
  *red = 0xff - *blue;
  *green = 0xff;
}


x86 assembly (clang, -O0):
<backLightTemp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cvttss2si -0x4(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xed5(%rip),%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    1142 <backLightTemp+0x42>
movss  0xec3(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  0xeb5(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1165 <backLightTemp+0x65>
movss  0xea4(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  0xe96(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  0xe84(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
movzbl (%rax),%ecx
mov    $0xff,%eax
sub    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
movb   $0xff,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<backLightTemp>:
cvttss2si %xmm0,%eax
cmp    $0x44,%eax
mov    $0x43,%ecx
cmovge %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
movss  0xee2(%rip),%xmm1
minss  %xmm0,%xmm1
addss  0xeda(%rip),%xmm1
mulss  0xed6(%rip),%xmm1
cvttss2si %xmm1,%eax
mov    %al,(%rdx)
not    %al
mov    %al,(%rdi)
movb   $0xff,(%rsi)
ret

LLVM IR (-O0):
define void @backLightTemp(float %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca float
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca float
store float %0, float* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load float, float* %5
%11 = fptosi float %10 to i32
%12 = sitofp i32 %11 to float
store float %12, float* %9
%13 = load float, float* %9
%14 = fcmp olt float %13, 6.700000e+01
br i1 %14, label %15, label %16
15: ; preds = %4
store float 6.700000e+01, float* %9
br label %16
16: ; preds = %15, %4
%17 = load float, float* %9
%18 = fcmp ogt float %17, 8.300000e+01
br i1 %18, label %19, label %20
19: ; preds = %16
store float 8.300000e+01, float* %9
br label %20
20: ; preds = %19, %16
%21 = load float, float* %9
%22 = fsub float %21, 6.700000e+01
store float %22, float* %9
%23 = load float, float* %9
%24 = fmul float 1.593750e+01, %23
%25 = fptoui float %24 to i8
%26 = load i8*, i8** %8
store i8 %25, i8* %26
%27 = load i8*, i8** %8
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = sub nsw i32 255, %29
%31 = trunc i32 %30 to i8
%32 = load i8*, i8** %6
store i8 %31, i8* %32
%33 = load i8*, i8** %7
store i8 -1, i8* %33
ret void
}

LLVM IR (-O2):
define void @backLightTemp(float %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2, i8* nocapture writeonly %3) {
%5 = fptosi float %0 to i32
%6 = icmp sgt i32 %5, 67
%7 = select i1 %6, i32 %5, i32 67
%8 = sitofp i32 %7 to float
%9 = fcmp ogt float %8, 8.300000e+01
%10 = select i1 %9, float 8.300000e+01, float %8
%11 = fadd float %10, -6.700000e+01
%12 = fmul float %11, 1.593750e+01
%13 = fptoui float %12 to i8
store i8 %13, i8* %3
%14 = xor i8 %13, -1
store i8 %14, i8* %1
store i8 -1, i8* %2
ret void
}