double horowitz(inputramptime, tf, vs1, vs2, rise)
double inputramptime, tf, vs1, vs2;
int rise;
{
  double a, b, td;
  a = inputramptime / tf;
  if (rise == 1) {
    b = 0.5;
    td = tf * sqrt(log(vs1) * log(vs1) + 2 * a * b * (1.0 - vs1)) +
         tf * (log(vs1) - log(vs2));
  } else {
    b = 0.4;
    td = tf * sqrt(log(1.0 - vs1) * log(1.0 - vs1) + 2 * a * b * (vs1)) +
         tf * (log(1.0 - vs1) - log(1.0 - vs2));
  }
  return (td);
}


x86 assembly (clang, -O0):
<horowitz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x1,-0x24(%rbp)
jne    121c <horowitz+0xfc>
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  0xe53(%rip),%xmm3
subsd  -0x18(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <log@plt>
movsd  -0x60(%rbp),%xmm3
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm4
movsd  -0x48(%rbp),%xmm0
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    12f8 <horowitz+0x1d8>
movsd  0xdec(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdc5(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xdab(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xd96(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd5b(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd41(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1030 <log@plt>
movsd  -0x88(%rbp),%xmm3
ff
movsd  -0x80(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movaps %xmm0,%xmm4
movsd  -0x70(%rbp),%xmm0
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<horowitz>:
sub    $0x38,%rsp
movsd  %xmm3,0x20(%rsp)
movsd  %xmm1,0x30(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
cmp    $0x1,%edi
movsd  %xmm2,0x10(%rsp)
jne    11a1 <horowitz+0x81>
movapd %xmm2,%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <log@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
addsd  %xmm3,%xmm3
mulsd  0xe99(%rip),%xmm3
movsd  0xe81(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
mulsd  0x18(%rsp),%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11fb <horowitz+0xdb>
sqrtsd %xmm0,%xmm0
jmp    1206 <horowitz+0xe6>
movsd  0xe57(%rip),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
call   1030 <log@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <log@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
mulsd  0xe2d(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1223 <horowitz+0x103>
sqrtsd %xmm0,%xmm0
jmp    1228 <horowitz+0x108>
call   1040 <sqrt@plt>
movsd  0x10(%rsp),%xmm2
movsd  %xmm0,0x8(%rsp)
movapd %xmm2,%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
jmp    124d <horowitz+0x12d>
call   1040 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xdb9(%rip),%xmm0
subsd  0x20(%rsp),%xmm0
call   1030 <log@plt>
movsd  0x10(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm2
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @horowitz(double %0, double %1, double %2, double %3, i32 %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store i32 %4, i32* %10
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fdiv double %14, %15
store double %16, double* %11
%17 = load i32, i32* %10
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %42
19: ; preds = %5
store double 5.000000e-01, double* %12
%20 = load double, double* %7
%21 = load double, double* %8
%22 = call double @log(double %21)
%23 = load double, double* %8
%24 = call double @log(double %23)
%25 = load double, double* %11
%26 = fmul double 2.000000e+00, %25
%27 = load double, double* %12
%28 = fmul double %26, %27
%29 = load double, double* %8
%30 = fsub double 1.000000e+00, %29
%31 = fmul double %28, %30
%32 = call double @llvm.fmuladd.f64(double %22, double %24, double %31)
%33 = call double @sqrt(double %32)
%34 = load double, double* %7
%35 = load double, double* %8
%36 = call double @log(double %35)
%37 = load double, double* %9
%38 = call double @log(double %37)
%39 = fsub double %36, %38
%40 = fmul double %34, %39
%41 = call double @llvm.fmuladd.f64(double %20, double %33, double %40)
store double %41, double* %13
br label %68
42: ; preds = %5
store double 4.000000e-01, double* %12
%43 = load double, double* %7
%44 = load double, double* %8
%45 = fsub double 1.000000e+00, %44
%46 = call double @log(double %45)
%47 = load double, double* %8
%48 = fsub double 1.000000e+00, %47
%49 = call double @log(double %48)
%50 = load double, double* %11
%51 = fmul double 2.000000e+00, %50
%52 = load double, double* %12
%53 = fmul double %51, %52
%54 = load double, double* %8
%55 = fmul double %53, %54
%56 = call double @llvm.fmuladd.f64(double %46, double %49, double %55)
%57 = call double @sqrt(double %56)
%58 = load double, double* %7
%59 = load double, double* %8
%60 = fsub double 1.000000e+00, %59
%61 = call double @log(double %60)
%62 = load double, double* %9
%63 = fsub double 1.000000e+00, %62
%64 = call double @log(double %63)
%65 = fsub double %61, %64
%66 = fmul double %58, %65
%67 = call double @llvm.fmuladd.f64(double %43, double %57, double %66)
store double %67, double* %13
br label %68
68: ; preds = %42, %19
%69 = load double, double* %13
ret double %69
}

LLVM IR (-O2):
define double @horowitz(double %0, double %1, double %2, double %3, i32 %4) {
%6 = fdiv double %0, %1
%7 = icmp eq i32 %4, 1
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = tail call double @log(double %2)
%10 = tail call double @log(double %2)
%11 = fmul double %6, 2.000000e+00
%12 = fmul double %11, 5.000000e-01
%13 = fsub double 1.000000e+00, %2
%14 = fmul double %13, %12
%15 = tail call double @llvm.fmuladd.f64(double %9, double %10, double %14)
%16 = tail call double @sqrt(double %15)
%17 = tail call double @log(double %2)
br label %29
18: ; preds = %5
%19 = fsub double 1.000000e+00, %2
%20 = tail call double @log(double %19)
%21 = tail call double @log(double %19)
%22 = fmul double %6, 2.000000e+00
%23 = fmul double %22, 4.000000e-01
%24 = fmul double %23, %2
%25 = tail call double @llvm.fmuladd.f64(double %20, double %21, double %24)
%26 = tail call double @sqrt(double %25)
%27 = tail call double @log(double %19)
%28 = fsub double 1.000000e+00, %3
br label %29
29: ; preds = %18, %8
%30 = phi double [ %28, %18 ], [ %3, %8 ]
%31 = phi double [ %27, %18 ], [ %17, %8 ]
%32 = phi double [ %26, %18 ], [ %16, %8 ]
%33 = tail call double @log(double %30)
%34 = fsub double %31, %33
%35 = fmul double %34, %1
%36 = tail call double @llvm.fmuladd.f64(double %1, double %32, double %35)
ret double %36
}