#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 log(double);
double pow(double, double);
double expexp(double x, double a, double b, double c, double d) {
  if (x <= a)
    return c;
  if (x >= b)
    return d;
  return pow(d / c, log(x / a)) / (log(b / a)) * c;
}


x86 assembly (clang, -O0):
<expexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1164 <expexp+0x44>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d8 <expexp+0xb8>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1183 <expexp+0x63>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d8 <expexp+0xb8>
movsd  -0x30(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expexp>:
ucomisd %xmm0,%xmm1
jae    1193 <expexp+0x73>
ucomisd %xmm2,%xmm0
jae    1198 <expexp+0x78>
sub    $0x28,%rsp
divsd  %xmm3,%xmm4
movsd  %xmm4,0x8(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1030 <log@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
call   1030 <log@plt>
movsd  0x20(%rsp),%xmm3
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm3
add    $0x28,%rsp
movapd %xmm3,%xmm0
ret
movaps %xmm4,%xmm0
ret

LLVM IR (-O0):
define double @expexp(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
%12 = load double, double* %7
%13 = load double, double* %8
%14 = fcmp ole double %12, %13
br i1 %14, label %15, label %17
15: ; preds = %5
%16 = load double, double* %10
store double %16, double* %6
br label %39
17: ; preds = %5
%18 = load double, double* %7
%19 = load double, double* %9
%20 = fcmp oge double %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = load double, double* %11
store double %22, double* %6
br label %39
23: ; preds = %17
%24 = load double, double* %11
%25 = load double, double* %10
%26 = fdiv double %24, %25
%27 = load double, double* %7
%28 = load double, double* %8
%29 = fdiv double %27, %28
%30 = call double @log(double %29)
%31 = call double @pow(double %26, double %30)
%32 = load double, double* %9
%33 = load double, double* %8
%34 = fdiv double %32, %33
%35 = call double @log(double %34)
%36 = fdiv double %31, %35
%37 = load double, double* %10
%38 = fmul double %36, %37
store double %38, double* %6
br label %39
39: ; preds = %23, %21, %15
%40 = load double, double* %6
ret double %40
}

LLVM IR (-O2):
define double @expexp(double %0, double %1, double %2, double %3, double %4) {
%6 = fcmp ugt double %0, %1
br i1 %6, label %7, label %18
7: ; preds = %5
%8 = fcmp ult double %0, %2
br i1 %8, label %9, label %18
9: ; preds = %7
%10 = fdiv double %4, %3
%11 = fdiv double %0, %1
%12 = tail call double @log(double %11)
%13 = tail call double @pow(double %10, double %12)
%14 = fdiv double %2, %1
%15 = tail call double @log(double %14)
%16 = fdiv double %13, %15
%17 = fmul double %16, %3
br label %18
18: ; preds = %7, %5, %9
%19 = phi double [ %17, %9 ], [ %3, %5 ], [ %4, %7 ]
ret double %19
}