double SIM_power_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(fabs(log(vs1) * log(vs1) + 2 * a * b * (1.0 - vs1))) +
         tf * (log(vs1) - log(vs2));
  } else {
    b = 0.4;
    td = tf * sqrt(fabs(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):
<SIM_power_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    1227 <SIM_power_horowitz+0x107>
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
movaps 0xe5b(%rip),%xmm1
pand   %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    130e <SIM_power_horowitz+0x1ee>
movsd  0xde1(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdba(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xda0(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xd8b(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movaps 0xd85(%rip),%xmm1
pand   %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd45(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd2b(%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):
<SIM_power_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    11a9 <SIM_power_horowitz+0x89>
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
andpd  0xe87(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     120b <SIM_power_horowitz+0xeb>
sqrtsd %xmm0,%xmm0
jmp    1216 <SIM_power_horowitz+0xf6>
movsd  0xe4f(%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  0xe25(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm0
addsd  %xmm1,%xmm0
andpd  0xe25(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1233 <SIM_power_horowitz+0x113>
sqrtsd %xmm0,%xmm0
jmp    1238 <SIM_power_horowitz+0x118>
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    125d <SIM_power_horowitz+0x13d>
call   1040 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xda9(%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 @SIM_power_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 %43
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 @llvm.fabs.f64(double %32)
%34 = call double @sqrt(double %33)
%35 = load double, double* %7
%36 = load double, double* %8
%37 = call double @log(double %36)
%38 = load double, double* %9
%39 = call double @log(double %38)
%40 = fsub double %37, %39
%41 = fmul double %35, %40
%42 = call double @llvm.fmuladd.f64(double %20, double %34, double %41)
store double %42, double* %13
br label %70
43: ; preds = %5
store double 4.000000e-01, double* %12
%44 = load double, double* %7
%45 = load double, double* %8
%46 = fsub double 1.000000e+00, %45
%47 = call double @log(double %46)
%48 = load double, double* %8
%49 = fsub double 1.000000e+00, %48
%50 = call double @log(double %49)
%51 = load double, double* %11
%52 = fmul double 2.000000e+00, %51
%53 = load double, double* %12
%54 = fmul double %52, %53
%55 = load double, double* %8
%56 = fmul double %54, %55
%57 = call double @llvm.fmuladd.f64(double %47, double %50, double %56)
%58 = call double @llvm.fabs.f64(double %57)
%59 = call double @sqrt(double %58)
%60 = load double, double* %7
%61 = load double, double* %8
%62 = fsub double 1.000000e+00, %61
%63 = call double @log(double %62)
%64 = load double, double* %9
%65 = fsub double 1.000000e+00, %64
%66 = call double @log(double %65)
%67 = fsub double %63, %66
%68 = fmul double %60, %67
%69 = call double @llvm.fmuladd.f64(double %44, double %59, double %68)
store double %69, double* %13
br label %70
70: ; preds = %43, %19
%71 = load double, double* %13
ret double %71
}

LLVM IR (-O2):
define double @SIM_power_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 %19
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 @llvm.fabs.f64(double %15)
%17 = tail call double @sqrt(double %16)
%18 = tail call double @log(double %2)
br label %31
19: ; preds = %5
%20 = fsub double 1.000000e+00, %2
%21 = tail call double @log(double %20)
%22 = tail call double @log(double %20)
%23 = fmul double %6, 2.000000e+00
%24 = fmul double %23, 4.000000e-01
%25 = fmul double %24, %2
%26 = tail call double @llvm.fmuladd.f64(double %21, double %22, double %25)
%27 = tail call double @llvm.fabs.f64(double %26)
%28 = tail call double @sqrt(double %27)
%29 = tail call double @log(double %20)
%30 = fsub double 1.000000e+00, %3
br label %31
31: ; preds = %19, %8
%32 = phi double [ %30, %19 ], [ %3, %8 ]
%33 = phi double [ %29, %19 ], [ %18, %8 ]
%34 = phi double [ %28, %19 ], [ %17, %8 ]
%35 = tail call double @log(double %32)
%36 = fsub double %33, %35
%37 = fmul double %36, %1
%38 = tail call double @llvm.fmuladd.f64(double %1, double %34, double %37)
ret double %38
}