#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 exp(double);
double esum(int mu, double x) {
  double ret_val;
  double w;
  if (x > 0.0) {
    goto L10;
  }
  if (mu < 0) {
    goto L20;
  }
  w = mu + x;
  if (w > 0.0) {
    goto L20;
  }
  ret_val = exp(w);
  return ret_val;
L10:
  if (mu > 0) {
    goto L20;
  }
  w = mu + x;
  if (w < 0.0) {
    goto L20;
  }
  ret_val = exp(w);
  return ret_val;
L20:
  w = (double)(mu);
  ret_val = exp(w) * exp(x);
  return ret_val;
}


x86 assembly (clang, -O0):
<esum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1137 <esum+0x27>
jmp    118a <esum+0x7a>
cmpl   $0x0,-0xc(%rbp)
jge    1146 <esum+0x36>
jmp    11d9 <esum+0xc9>
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    116c <esum+0x5c>
jmp    11d9 <esum+0xc9>
movsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1217 <esum+0x107>
cmpl   $0x0,-0xc(%rbp)
jle    1199 <esum+0x89>
jmp    11d9 <esum+0xc9>
cvtsi2sdl -0xc(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11bb <esum+0xab>
jmp    11d9 <esum+0xc9>
movsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1217 <esum+0x107>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<esum>:
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
jbe    113d <esum+0x2d>
test   %edi,%edi
jg     1153 <esum+0x43>
movapd %xmm0,%xmm1
addsd  %xmm3,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
ja     1153 <esum+0x43>
jmp    117e <esum+0x6e>
test   %edi,%edi
js     1153 <esum+0x43>
movapd %xmm0,%xmm1
addsd  %xmm3,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jbe    117e <esum+0x6e>
sub    $0x18,%rsp
movsd  %xmm3,0x8(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret
movapd %xmm1,%xmm0
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @esum(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
%8 = load double, double* %5
%9 = fcmp ogt double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %2
br label %27
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
br label %43
15: ; preds = %11
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = load double, double* %5
%19 = fadd double %17, %18
store double %19, double* %7
%20 = load double, double* %7
%21 = fcmp ogt double %20, 0.000000e+00
br i1 %21, label %22, label %23
22: ; preds = %15
br label %43
23: ; preds = %15
%24 = load double, double* %7
%25 = call double @exp(double %24)
store double %25, double* %6
%26 = load double, double* %6
store double %26, double* %3
br label %52
27: ; preds = %10
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
br label %43
31: ; preds = %27
%32 = load i32, i32* %4
%33 = sitofp i32 %32 to double
%34 = load double, double* %5
%35 = fadd double %33, %34
store double %35, double* %7
%36 = load double, double* %7
%37 = fcmp olt double %36, 0.000000e+00
br i1 %37, label %38, label %39
38: ; preds = %31
br label %43
39: ; preds = %31
%40 = load double, double* %7
%41 = call double @exp(double %40)
store double %41, double* %6
%42 = load double, double* %6
store double %42, double* %3
br label %52
43: ; preds = %38, %30, %22, %14
%44 = load i32, i32* %4
%45 = sitofp i32 %44 to double
store double %45, double* %7
%46 = load double, double* %7
%47 = call double @exp(double %46)
%48 = load double, double* %5
%49 = call double @exp(double %48)
%50 = fmul double %47, %49
store double %50, double* %6
%51 = load double, double* %6
store double %51, double* %3
br label %52
52: ; preds = %43, %39, %23
%53 = load double, double* %3
ret double %53
}

LLVM IR (-O2):
define double @esum(i32 %0, double %1) {
%3 = fcmp ogt double %1, 0.000000e+00
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = icmp slt i32 %0, 0
br i1 %5, label %20, label %6
6: ; preds = %4
%7 = sitofp i32 %0 to double
%8 = fadd double %7, %1
%9 = fcmp ogt double %8, 0.000000e+00
br i1 %9, label %20, label %10
10: ; preds = %6
%11 = tail call double @exp(double %8)
br label %25
12: ; preds = %2
%13 = icmp sgt i32 %0, 0
br i1 %13, label %20, label %14
14: ; preds = %12
%15 = sitofp i32 %0 to double
%16 = fadd double %15, %1
%17 = fcmp olt double %16, 0.000000e+00
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = tail call double @exp(double %16)
br label %25
20: ; preds = %14, %12, %6, %4
%21 = sitofp i32 %0 to double
%22 = tail call double @exp(double %21)
%23 = tail call double @exp(double %1)
%24 = fmul double %22, %23
br label %25
25: ; preds = %20, %18, %10
%26 = phi double [ %24, %20 ], [ %19, %18 ], [ %11, %10 ]
ret double %26
}