#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 */
int log(double);
double pow(double, int);
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    11d1 <expexp+0xb1>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1183 <expexp+0x63>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <expexp+0xb1>
movsd  -0x30(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
mov    %eax,-0x34(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  -0x40(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <pow@plt>
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    118a <expexp+0x6a>
ucomisd %xmm2,%xmm0
jae    118f <expexp+0x6f>
push   %rbx
sub    $0x20,%rsp
divsd  %xmm3,%xmm4
movsd  %xmm4,0x10(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1030 <log@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
call   1030 <log@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
movsd  0x10(%rsp),%xmm0
mov    %eax,%edi
call   1040 <pow@plt>
movsd  0x18(%rsp),%xmm3
mulsd  %xmm0,%xmm3
add    $0x20,%rsp
pop    %rbx
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 i32 @log(double %29)
%31 = load double, double* %9
%32 = load double, double* %8
%33 = fdiv double %31, %32
%34 = call i32 @log(double %33)
%35 = sdiv i32 %30, %34
%36 = call double @pow(double %26, i32 %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 i32 @log(double %11)
%13 = fdiv double %2, %1
%14 = tail call i32 @log(double %13)
%15 = sdiv i32 %12, %14
%16 = tail call double @pow(double %10, i32 %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
}