#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*/ houston_WriteReg(int, unsigned long, int);
void config_color(int color) {
  unsigned long clr;
  clr = (unsigned long)(0.8f + ((float)color * 255.0f / 100.0f));
  clr = ((((0)) > ((((clr)) < ((255)) ? ((clr)) : ((255))))
              ? ((0))
              : ((((clr)) < ((255)) ? ((clr)) : ((255))))));
  houston_WriteReg(0x62, clr, 1);
  houston_WriteReg(0x60, clr, 1);
}


x86 assembly (clang, -O0):
<config_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xed8(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xed0(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xec8(%rip),%xmm1
addss  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttss2si %xmm1,%rax
mov    %rax,%rdx
sar    $0x3f,%rdx
movss  0xeb1(%rip),%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%rcx
and    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0xff,-0x10(%rbp)
jae    1189 <config_color+0x79>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1197 <config_color+0x87>
mov    $0xff,%eax
mov    %rax,-0x18(%rbp)
jmp    1197 <config_color+0x87>
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jbe    11b1 <config_color+0xa1>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    11e2 <config_color+0xd2>
cmpq   $0xff,-0x10(%rbp)
jae    11cc <config_color+0xbc>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11da <config_color+0xca>
mov    $0xff,%eax
mov    %rax,-0x28(%rbp)
jmp    11da <config_color+0xca>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x62,%edi
mov    $0x1,%edx
call   1030 <houston_WriteReg@plt>
mov    -0x10(%rbp),%rsi
mov    $0x60,%edi
mov    $0x1,%edx
call   1030 <houston_WriteReg@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_color>:
push   %rbx
cvtsi2ss %edi,%xmm0
mulss  0xee3(%rip),%xmm0
divss  0xedf(%rip),%xmm0
addss  0xedb(%rip),%xmm0
cvttss2si %xmm0,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subss  0xecb(%rip),%xmm0
cvttss2si %xmm0,%rdx
and    %rcx,%rdx
or     %rax,%rdx
cmp    $0xff,%rdx
mov    $0xff,%ebx
cmovb  %rdx,%rbx
mov    $0x62,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <houston_WriteReg@plt>
mov    $0x60,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
pop    %rbx
jmp    1030 <houston_WriteReg@plt>

LLVM IR (-O0):
define void @config_color(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to float
%6 = fmul float %5, 2.550000e+02
%7 = fdiv float %6, 1.000000e+02
%8 = fadd float 0x3FE99999A0000000, %7
%9 = fptoui float %8 to i64
store i64 %9, i64* %3
%10 = load i64, i64* %3
%11 = icmp ult i64 %10, 255
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = load i64, i64* %3
br label %15
14: ; preds = %1
br label %15
15: ; preds = %14, %12
%16 = phi i64 [ %13, %12 ], [ 255, %14 ]
%17 = icmp ugt i64 0, %16
br i1 %17, label %18, label %19
18: ; preds = %15
br label %27
19: ; preds = %15
%20 = load i64, i64* %3
%21 = icmp ult i64 %20, 255
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = load i64, i64* %3
br label %25
24: ; preds = %19
br label %25
25: ; preds = %24, %22
%26 = phi i64 [ %23, %22 ], [ 255, %24 ]
br label %27
27: ; preds = %25, %18
%28 = phi i64 [ 0, %18 ], [ %26, %25 ]
store i64 %28, i64* %3
%29 = load i64, i64* %3
%30 = call i32 @houston_WriteReg(i32 98, i64 %29, i32 1)
%31 = load i64, i64* %3
%32 = call i32 @houston_WriteReg(i32 96, i64 %31, i32 1)
ret void
}

LLVM IR (-O2):
define void @config_color(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = fmul float %2, 2.550000e+02
%4 = fdiv float %3, 1.000000e+02
%5 = fadd float %4, 0x3FE99999A0000000
%6 = fptoui float %5 to i64
%7 = icmp ult i64 %6, 255
%8 = select i1 %7, i64 %6, i64 255
%9 = tail call i32 @houston_WriteReg(i32 98, i64 %8, i32 1)
%10 = tail call i32 @houston_WriteReg(i32 96, i64 %8, i32 1)
ret void
}