#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 /*<<< orphan*/ error(char *);
double exp(double);
double expcdf(double x, double lambda) {
  if (lambda < 0)
    error("Parameter lambda is smaller than 0.");
  if (x < 0)
    return 0.0;
  return 1 - exp(-lambda * x);
}


x86 assembly (clang, -O0):
<expcdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    114c <expcdf+0x2c>
lea    0xec1(%rip),%rdi
call   1040 <error@plt>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1167 <expcdf+0x47>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a1 <expcdf+0x81>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe68(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expcdf>:
sub    $0x28,%rsp
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    1156 <expcdf+0x36>
lea    0xee3(%rip),%rdi
movapd %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1040 <error@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm2,%xmm2
movapd 0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm2
ja     117d <expcdf+0x5d>
xorpd  0xe9c(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
movsd  0xe97(%rip),%xmm2
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Parameter lambda is smaller than 0.\00"
define double @expcdf(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load double, double* %4
%12 = fcmp olt double %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
store double 0.000000e+00, double* %3
br label %21
14: ; preds = %10
%15 = load double, double* %5
%16 = fneg double %15
%17 = load double, double* %4
%18 = fmul double %16, %17
%19 = call double @exp(double %18)
%20 = fsub double 1.000000e+00, %19
store double %20, double* %3
br label %21
21: ; preds = %14, %13
%22 = load double, double* %3
ret double %22
}

LLVM IR (-O2):
@.str = [36 x i8] c"Parameter lambda is smaller than 0.\00"
define double @expcdf(double %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = fcmp olt double %0, 0.000000e+00
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = fneg double %1
%10 = fmul double %9, %0
%11 = tail call double @exp(double %10)
%12 = fsub double 1.000000e+00, %11
br label %13
13: ; preds = %6, %8
%14 = phi double [ %12, %8 ], [ 0.000000e+00, %6 ]
ret double %14
}