#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 int, int);
void config_flicker(int flicker) {
  unsigned int flk;
  flk = (unsigned int)(0.5f + ((float)flicker * 16.0f / 1000.0f));
  flk = ((((0)) > ((((flk)) < ((16)) ? ((flk)) : ((16))))
              ? ((0))
              : ((((flk)) < ((16)) ? ((flk)) : ((16))))));
  houston_WriteReg(0x26, flk, 2);
}


x86 assembly (clang, -O0):
<config_flicker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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
cvttss2si %xmm0,%rax
mov    %eax,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jae    1161 <config_flicker+0x51>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    116e <config_flicker+0x5e>
mov    $0x10,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <config_flicker+0x5e>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jbe    1185 <config_flicker+0x75>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    11ad <config_flicker+0x9d>
cmpl   $0x10,-0x8(%rbp)
jae    119a <config_flicker+0x8a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11a7 <config_flicker+0x97>
mov    $0x10,%eax
mov    %eax,-0x14(%rbp)
jmp    11a7 <config_flicker+0x97>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x26,%edi
mov    $0x2,%edx
call   1030 <houston_WriteReg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_flicker>:
cvtsi2ss %edi,%xmm0
mulss  0xee4(%rip),%xmm0
divss  0xee0(%rip),%xmm0
addss  0xedc(%rip),%xmm0
cvttss2si %xmm0,%rax
cmp    $0x10,%eax
mov    $0x10,%esi
cmovb  %eax,%esi
mov    $0x26,%edi
mov    $0x2,%edx
jmp    1030 <houston_WriteReg@plt>

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

LLVM IR (-O2):
define void @config_flicker(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = fmul float %2, 1.600000e+01
%4 = fdiv float %3, 1.000000e+03
%5 = fadd float %4, 5.000000e-01
%6 = fptoui float %5 to i32
%7 = icmp ult i32 %6, 16
%8 = select i1 %7, i32 %6, i32 16
%9 = tail call i32 @houston_WriteReg(i32 38, i32 %8, i32 2)
ret void
}