#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 M_LOG2E;
double log(double);
double f2B(double f) {
  return (f <= 0.0)
             ? 0.2
             : ((f <= 500.0) ? f * 0.01 : 9.0 + 4.0 * M_LOG2E * log(f * 0.001));
}


x86 assembly (clang, -O0):
<f2B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     113d <f2B+0x2d>
movsd  0xef5(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11b8 <f2B+0xa8>
movsd  0xebb(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     1167 <f2B+0x57>
movsd  0xec8(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11ae <f2B+0x9e>
movsd  0xea9(%rip),%xmm0
mov    0x2e6a(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe89(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe63(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2B>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    115d <f2B+0x4d>
movsd  0xee5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1167 <f2B+0x57>
mov    0x2eb0(%rip),%rax
movsd  (%rax),%xmm1
mulsd  0xedc(%rip),%xmm1
movsd  %xmm1,(%rsp)
mulsd  0xed7(%rip),%xmm0
call   1030 <log@plt>
mulsd  (%rsp),%xmm0
addsd  0xecd(%rip),%xmm0
pop    %rax
ret
movsd  0xe9b(%rip),%xmm0
pop    %rax
ret
mulsd  0xea1(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_LOG2E = global double 0.000000e+00
define double @f2B(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ole double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %21
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp ole double %7, 5.000000e+02
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load double, double* %2
%11 = fmul double %10, 1.000000e-02
br label %19
12: ; preds = %6
%13 = load double, double* @M_LOG2E
%14 = fmul double 4.000000e+00, %13
%15 = load double, double* %2
%16 = fmul double %15, 1.000000e-03
%17 = call double @log(double %16)
%18 = call double @llvm.fmuladd.f64(double %14, double %17, double 9.000000e+00)
br label %19
19: ; preds = %12, %9
%20 = phi double [ %11, %9 ], [ %18, %12 ]
br label %21
21: ; preds = %19, %5
%22 = phi double [ 2.000000e-01, %5 ], [ %20, %19 ]
ret double %22
}

LLVM IR (-O2):
@M_LOG2E = global double 0.000000e+00
define double @f2B(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %3, label %13
3: ; preds = %1
%4 = fcmp ugt double %0, 5.000000e+02
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = fmul double %0, 1.000000e-02
br label %13
7: ; preds = %3
%8 = load double, double* @M_LOG2E
%9 = fmul double %8, 4.000000e+00
%10 = fmul double %0, 1.000000e-03
%11 = tail call double @log(double %10)
%12 = tail call double @llvm.fmuladd.f64(double %9, double %11, double 9.000000e+00)
br label %13
13: ; preds = %5, %7, %1
%14 = phi double [ 2.000000e-01, %1 ], [ %6, %5 ], [ %12, %7 ]
ret double %14
}