#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t estimate_vcocap(unsigned int f_target, unsigned int f_low,
                        unsigned int f_high) {
  unsigned int vcocap;
  const float denom = (float)(f_high - f_low);
  const float num = (55 - 15);
  const float f_diff = (float)(f_target - f_low);
  vcocap = (unsigned int)((num / denom * f_diff) + 0.5 + 15);
  if (vcocap > 0x3f) {
    do {
      do {
      } while (0);
    } while (0);
    vcocap = 0x3f;
  } else {
    do {
      do {
      } while (0);
    } while (0);
  }
  return (uint8_t)vcocap;
}


x86 assembly (clang, -O0):
<estimate_vcocap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x42200000,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm1
movss  0xebb(%rip),%xmm0
divss  %xmm1,%xmm0
movss  -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeaa(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xea6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,-0x10(%rbp)
cmpl   $0x3f,-0x10(%rbp)
jbe    11a0 <estimate_vcocap+0xa0>
jmp    1185 <estimate_vcocap+0x85>
jmp    118a <estimate_vcocap+0x8a>
jmp    118f <estimate_vcocap+0x8f>
jmp    1194 <estimate_vcocap+0x94>
movl   $0x3f,-0x10(%rbp)
jmp    11b9 <estimate_vcocap+0xb9>
jmp    11a5 <estimate_vcocap+0xa5>
jmp    11aa <estimate_vcocap+0xaa>
jmp    11af <estimate_vcocap+0xaf>
jmp    11b4 <estimate_vcocap+0xb4>
jmp    11b9 <estimate_vcocap+0xb9>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<estimate_vcocap>:
sub    %esi,%edx
cvtsi2ss %rdx,%xmm0
sub    %esi,%edi
cvtsi2ss %rdi,%xmm1
movss  0xeea(%rip),%xmm2
divss  %xmm0,%xmm2
mulss  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
addsd  0xedb(%rip),%xmm0
addsd  0xedb(%rip),%xmm0
cvttsd2si %xmm0,%rcx
cmp    $0x3f,%ecx
mov    $0x3f,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @estimate_vcocap(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = sub i32 %11, %12
%14 = uitofp i32 %13 to float
store float %14, float* %8
store float 4.000000e+01, float* %9
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = sub i32 %15, %16
%18 = uitofp i32 %17 to float
store float %18, float* %10
%19 = load float, float* %8
%20 = fdiv float 4.000000e+01, %19
%21 = load float, float* %10
%22 = fmul float %20, %21
%23 = fpext float %22 to double
%24 = fadd double %23, 5.000000e-01
%25 = fadd double %24, 1.500000e+01
%26 = fptoui double %25 to i32
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp ugt i32 %27, 63
br i1 %28, label %29, label %34
29: ; preds = %3
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32
store i32 63, i32* %7
br label %39
34: ; preds = %3
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
br label %38
38: ; preds = %37
br label %39
39: ; preds = %38, %33
%40 = load i32, i32* %7
ret i32 %40
}

LLVM IR (-O2):
define i32 @estimate_vcocap(i32 %0, i32 %1, i32 %2) {
%4 = sub i32 %2, %1
%5 = uitofp i32 %4 to float
%6 = sub i32 %0, %1
%7 = uitofp i32 %6 to float
%8 = fdiv float 4.000000e+01, %5
%9 = fmul float %8, %7
%10 = fpext float %9 to double
%11 = fadd double %10, 5.000000e-01
%12 = fadd double %11, 1.500000e+01
%13 = fptoui double %12 to i32
%14 = icmp ult i32 %13, 63
%15 = select i1 %14, i32 %13, i32 63
ret i32 %15
}