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


x86 assembly (clang, -O0):
<exppdf>:
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 <exppdf+0x2c>
lea    0xeb9(%rip),%rdi
call   1040 <error@plt>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1167 <exppdf+0x47>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a8 <exppdf+0x88>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
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  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exppdf>:
sub    $0x28,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
movapd %xmm1,0x10(%rsp)
ucomisd %xmm1,%xmm0
ja     1143 <exppdf+0x23>
ucomisd %xmm2,%xmm0
jbe    1165 <exppdf+0x45>
add    $0x28,%rsp
ret
lea    0xec6(%rip),%rdi
movsd  %xmm2,0x8(%rsp)
call   1040 <error@plt>
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm2
ucomisd %xmm2,%xmm0
ja     113e <exppdf+0x1e>
movapd 0xe93(%rip),%xmm0
xorpd  0x10(%rsp),%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Parameter lambda is smaller than 0.\00"
define double @exppdf(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 %22
14: ; preds = %10
%15 = load double, double* %5
%16 = load double, double* %5
%17 = fneg double %16
%18 = load double, double* %4
%19 = fmul double %17, %18
%20 = call double @exp(double %19)
%21 = fmul double %15, %20
store double %21, double* %3
br label %22
22: ; preds = %14, %13
%23 = load double, double* %3
ret double %23
}

LLVM IR (-O2):
@.str = [36 x i8] c"Parameter lambda is smaller than 0.\00"
define double @exppdf(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 = fmul double %11, %1
br label %13
13: ; preds = %6, %8
%14 = phi double [ %12, %8 ], [ 0.000000e+00, %6 ]
ret double %14
}