#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 LINN();
int /*<<< orphan*/ assert(int);
double exp(double);
double log(double);
double lincombin(double a, double b, double t) {
  double linn = LINN();
  if (linn < -1)
    return t < 0.5 ? a : b;
  if (linn < 0)
    return a * (1 - t) + b * t;
  assert(t >= 0 && t <= 1);
  double la = exp(a / linn);
  double lb = exp(b / linn);
  double lr = la * (1 - t) + lb * t;
  double r = linn * log(lr);
  return r;
}


x86 assembly (clang, -O0):
<lincombin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    $0x0,%al
call   1050 <LINN@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xe95(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11b1 <lincombin+0x71>
movsd  0xe92(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1198 <lincombin+0x58>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11a2 <lincombin+0x62>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a4 <lincombin+0x164>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11ed <lincombin+0xad>
movsd  -0x10(%rbp),%xmm0
movsd  0xe3c(%rip),%xmm2
subsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a4 <lincombin+0x164>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x51(%rbp)
jb     1217 <lincombin+0xd7>
movsd  0xdfc(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
setae  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xdaf(%rip),%xmm2
subsd  -0x20(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1060 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lincombin>:
sub    $0x48,%rsp
movapd %xmm2,0x30(%rsp)
movaps %xmm1,0x20(%rsp)
movapd %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1050 <LINN@plt>
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1192 <lincombin+0x52>
movapd 0x30(%rsp),%xmm0
cmpltsd 0xe97(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
andpd  %xmm0,%xmm1
andnpd 0x20(%rsp),%xmm0
orpd   %xmm1,%xmm0
add    $0x48,%rsp
ret
movapd 0x30(%rsp),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
jbe    11cb <lincombin+0x8b>
movsd  0xe5e(%rip),%xmm3
subsd  %xmm1,%xmm3
movapd 0x20(%rsp),%xmm2
mulsd  %xmm1,%xmm2
movapd 0x10(%rsp),%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
add    $0x48,%rsp
ret
ucomisd %xmm2,%xmm1
setae  %al
movsd  0xe2e(%rip),%xmm2
ucomisd %xmm1,%xmm2
setae  %cl
and    %al,%cl
movzbl %cl,%edi
movsd  %xmm0,0x8(%rsp)
call   1030 <assert@plt>
movapd 0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
call   1040 <exp@plt>
movsd  0xde7(%rip),%xmm1
movapd 0x30(%rsp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm0
mulsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
call   1060 <log@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
define double @lincombin(double %0, double %1, double %2) {
%4 = tail call double (...) @LINN()
%5 = fcmp olt double %4, -1.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = fcmp olt double %2, 5.000000e-01
%8 = select i1 %7, double %0, double %1
br label %30
9: ; preds = %3
%10 = fcmp olt double %4, 0.000000e+00
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = fsub double 1.000000e+00, %2
%13 = fmul double %1, %2
%14 = tail call double @llvm.fmuladd.f64(double %0, double %12, double %13)
br label %30
15: ; preds = %9
%16 = fcmp oge double %2, 0.000000e+00
%17 = fcmp ole double %2, 1.000000e+00
%18 = and i1 %16, %17
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = fdiv double %0, %4
%22 = tail call double @exp(double %21)
%23 = fdiv double %1, %4
%24 = tail call double @exp(double %23)
%25 = fsub double 1.000000e+00, %2
%26 = fmul double %24, %2
%27 = tail call double @llvm.fmuladd.f64(double %22, double %25, double %26)
%28 = tail call double @log(double %27)
%29 = fmul double %4, %28
br label %30
30: ; preds = %15, %11, %6
%31 = phi double [ %8, %6 ], [ %14, %11 ], [ %29, %15 ]
ret double %31
}